From: Michal Kubecek <mkubecek@suse.cz>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH ethtool 1/7] netlink: get rid of signed/unsigned comparison warnings
Date: Tue, 11 Aug 2020 22:30:13 +0200 [thread overview]
Message-ID: <20200811203013.bchsqf5syvefpope@carpenter> (raw)
In-Reply-To: <20200810141122.GD2123435@lunn.ch>
On Mon, Aug 10, 2020 at 04:11:22PM +0200, Andrew Lunn wrote:
> On Sun, Aug 09, 2020 at 11:24:19PM +0200, Michal Kubecek wrote:
> > Get rid of compiler warnings about comparison between signed and
> > unsigned integer values in netlink code.
> >
> > Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> > ---
> > netlink/features.c | 4 ++--
> > netlink/netlink.c | 4 ++--
> > netlink/netlink.h | 2 +-
> > netlink/nlsock.c | 2 +-
> > netlink/parser.c | 2 +-
> > netlink/settings.c | 6 +++---
> > 6 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/netlink/features.c b/netlink/features.c
> > index 8b5b8588ca23..f5862e97a265 100644
> > --- a/netlink/features.c
> > +++ b/netlink/features.c
> > @@ -149,7 +149,7 @@ int dump_features(const struct nlattr *const *tb,
> > continue;
> >
> > for (j = 0; j < results.count; j++) {
> > - if (feature_flags[j] == i) {
> > + if (feature_flags[j] == (int)i) {
> > n_match++;
> > flag_value = flag_value ||
> > feature_on(results.active, j);
> > @@ -163,7 +163,7 @@ int dump_features(const struct nlattr *const *tb,
> > for (j = 0; j < results.count; j++) {
> > const char *name = get_string(feature_names, j);
> >
> > - if (feature_flags[j] != i)
> > + if (feature_flags[j] != (int)i)
>
> Hi Michal
>
> Would it be better to make feature_flags an unsigned int * ? And
> change the -1 to MAX_UNIT?
It certainly would. I was actually thinking about this solution for
a moment but then I managed to mistake feature_flags with off_flag_def
and convinced myself that it's shared with ioctl code so that changing
its type would require changes there as well. Thank you for pointing
this out.
Michal
next prev parent reply other threads:[~2020-08-11 20:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-09 21:24 [PATCH ethtool 0/7] compiler warnings cleanup, part 2 Michal Kubecek
2020-08-09 21:24 ` [PATCH ethtool 1/7] netlink: get rid of signed/unsigned comparison warnings Michal Kubecek
2020-08-10 14:11 ` Andrew Lunn
2020-08-11 20:30 ` Michal Kubecek [this message]
2020-08-09 21:24 ` [PATCH ethtool 2/7] ioctl: check presence of eeprom length argument properly Michal Kubecek
2020-08-10 14:12 ` Andrew Lunn
2020-08-09 21:24 ` [PATCH ethtool 3/7] ioctl: get rid of signed/unsigned comparison warnings Michal Kubecek
2020-08-10 14:19 ` Andrew Lunn
2020-08-10 14:24 ` David Laight
2020-08-11 21:20 ` Michal Kubecek
2020-08-09 21:24 ` [PATCH ethtool 4/7] get rid of signed/unsigned comparison warnings in register dump parsers Michal Kubecek
2020-08-10 14:20 ` Andrew Lunn
2020-08-09 21:24 ` [PATCH ethtool 5/7] settings: simplify link_mode_info[] initializers Michal Kubecek
2020-08-10 14:21 ` Andrew Lunn
2020-08-09 21:24 ` [PATCH ethtool 6/7] ioctl: convert cmdline_info arrays to named initializers Michal Kubecek
2020-08-10 14:21 ` Andrew Lunn
2020-08-09 21:24 ` [PATCH ethtool 7/7] build: add -Wextra to default CFLAGS Michal Kubecek
2020-08-10 14:22 ` Andrew Lunn
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=20200811203013.bchsqf5syvefpope@carpenter \
--to=mkubecek@suse.cz \
--cc=andrew@lunn.ch \
--cc=netdev@vger.kernel.org \
/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