From: David Laight <david.laight.linux@gmail.com>
To: Simon Horman <horms@kernel.org>
Cc: Nick Child <nnac123@linux.ibm.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
haren@linux.ibm.com, ricklind@us.ibm.com, nick.child@ibm.com,
jacob.e.keller@intel.com
Subject: Re: [PATCH 1/3] hexdump: Implement macro for converting large buffers
Date: Sun, 16 Feb 2025 11:24:30 +0000 [thread overview]
Message-ID: <20250216112430.29c725c5@pumpkin> (raw)
In-Reply-To: <20250216093204.GZ1615191@kernel.org>
On Sun, 16 Feb 2025 09:32:04 +0000
Simon Horman <horms@kernel.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
next prev parent reply other threads:[~2025-02-16 11:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 16:24 [PATCH v2 0/3] Use new for_each macro to create hexdumps Nick Child
2025-02-14 16:24 ` [PATCH 1/3] hexdump: Implement macro for converting large buffers Nick Child
[not found] ` <87tt8wflt5.fsf@linux.ibm.com>
2025-02-14 18:33 ` Nick Child
2025-02-15 16:36 ` Simon Horman
2025-02-15 17:40 ` David Laight
2025-02-15 17:46 ` David Laight
2025-02-16 9:32 ` Simon Horman
2025-02-16 11:24 ` David Laight [this message]
2025-02-17 15:09 ` Nick Child
2025-02-18 12:31 ` Paolo Abeni
2025-02-14 16:24 ` [PATCH v2 2/3] hexdump: Use for_each macro in print_hex_dump Nick Child
2025-02-14 16:24 ` [PATCH v2 3/3] ibmvnic: Print data buffers with kernel API's Nick Child
-- strict thread matches above, loose matches on Subject: below --
2025-01-13 22:17 [PATCH 0/3] Use new for_each macro to create hexdumps Nick Child
2025-01-13 22:17 ` [PATCH 1/3] hexdump: Implement macro for converting large buffers Nick Child
2025-01-14 14:48 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250216112430.29c725c5@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=haren@linux.ibm.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nick.child@ibm.com \
--cc=nnac123@linux.ibm.com \
--cc=ricklind@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).