Thread (11 messages) flat view 11 messages, 4 authors, 2025-02-18

Re: [PATCH 1/3] hexdump: Implement macro for converting large buffers

From: David Laight <hidden>
Date: 2025-02-16 11:24:33
Also in: lkml

On Sun, 16 Feb 2025 09:32:04 +0000
Simon Horman [off-list ref] wrote:
...
quoted
quoted
Yep, that should fail for all versions of gcc.
Both 'i' and 'rowsize' should be unsigned types.
In fact all three can be 'unsigned int'.  
To give a bit more context, a complication changing the types is that the
type of len and rowsise (but not i) is in the signature of the calling
function, print_hex_dump(). And I believe that function is widely used
throughout the tree.
Doesn't matter, nothing with assign the address of the function to a
variable so changing the types (to unsigned) doesn't affect any callers.
The values better be positive!

I just changed the prototypes (include/linux/printk.h) to make both
rowsize and groupsize 'unsigned int'.
The same change in lib/hexdump.c + changing the local 'i, linelen, remaining'
to unsigned int and it all compiled.

FWIW that hexdump code is pretty horrid (especially if groupsize != 1).

	David

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help