[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250216112430.29c725c5@pumpkin>
Date: Sun, 16 Feb 2025 11:24:30 +0000
From: David Laight <david.laight.linux@...il.com>
To: Simon Horman <horms@...nel.org>
Cc: Nick Child <nnac123@...ux.ibm.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, haren@...ux.ibm.com, ricklind@...ibm.com,
nick.child@....com, jacob.e.keller@...el.com
Subject: Re: [PATCH 1/3] hexdump: Implement macro for converting large
buffers
On Sun, 16 Feb 2025 09:32:04 +0000
Simon Horman <horms@...nel.org> wrote:
>...
> > > 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
Powered by blists - more mailing lists