[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200811203013.bchsqf5syvefpope@carpenter>
Date: Tue, 11 Aug 2020 22:30:13 +0200
From: Michal Kubecek <mkubecek@...e.cz>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH ethtool 1/7] netlink: get rid of signed/unsigned
comparison warnings
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@...e.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
Powered by blists - more mailing lists