From: David Howells <dhowells@xxxxxxxxxx> > Sent: 28 August 2024 09:18 > > Hongbo Li <lihongbo22@xxxxxxxxxx> wrote: > > > I see reason is u8, so may I use min_t(u8, sp->ack.reason, > > RXRPC_ACK__INVALID)? > > No, please don't use min_t(<unsigned type>, ...) if umin() will do. IIRC, > some arches can't do byte-level arithmetic. Not to mention all the places where the wrong type has been used and significant bits masked off before the comparison. Is there even a problem with min() here? It should be fine unless sp->ack.reason is a signed type. In which case things are probably horribly wrong if it is negative. Looking at the code I'm not even sure that min() is right. It really ought to be used for counters/sizes. This is a bit like the (broken) suggestion of replacing: return rval < 0 ? rval : 0; with return min(rval, 0); David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)