From: Tom Rix > Sent: 25 December 2020 14:57 ... > > Kernel code doesn't use a signed char or short with %hx or %hu very often > > but in case you didn't already know, any signed char/short emitted with > > anything like %hx or %hu needs to be left alone as sign extension occurs so: > > Yes, this would also effect checkpatch. Does the kernel printf do the masking for %hx and %hhx? A quick check I did showed that (at least some versions of) glibc does. But the printf builtin in bash doesn't. If the masking is there then %h[diux] and %hh[diux] are valid even though the varargs supplied parameter is always extended to at least the size of int. This is even true if the parameter might be large. For instance doing: ..., "%hh02x:%hh02x:%hh02x:%hh02x", x >> 24, x >> 16, x >> 8, x); will generate slightly smaller code than masking the passed values. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)