All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Cong Wang <xiyou.wangcong@gmail.com>,
	Colin King <colin.king@canonical.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	pravin shelar <pshelar@ovn.org>,
	Wei Yongjun <weiyongjun1@huawei.com>,
	Florian Westphal <fw@strlen.de>,
	Tycho Andersen <tycho.andersen@canonical.com>,
	Tom Herbert <tom@herbertland.com>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] genetlink: fix unsigned int comparison with less than zero
Date: Sat, 12 Nov 2016 22:37:16 +0100	[thread overview]
Message-ID: <1478986636.4226.4.camel@sipsolutions.net> (raw)
In-Reply-To: <CAM_iQpW=q4nm97dNouSL19Cr2cEWT9xQHXAm4CNJk=AY8z_2MA@mail.gmail.com> (sfid-20161110_181214_593279_4F3243C4)

On Thu, 2016-11-10 at 09:11 -0800, Cong Wang wrote:
> On Thu, Nov 10, 2016 at 7:57 AM, Colin King <colin.king@canonical.com
> > wrote:
> > 
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > family->id is unsigned, so the less than zero check for
> > failure return from idr_alloc is never true and so the error exit
> > is never handled.  Instead, assign err and check if this is less
> > than zero since this is a signed integer.
> 
> Why family->id can't be just signed int? For me it should be.

I suppose it could be, since family IDs are allocated in a 16-bit range
anyway. But family IDs can also never actually be negative, so having
an unsigned int in the struct makes sense too.

I tend to think this patch is fine.

johannes

  reply	other threads:[~2016-11-12 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 15:57 [PATCH] genetlink: fix unsigned int comparison with less than zero Colin King
2016-11-10 17:11 ` Cong Wang
2016-11-12 21:37   ` Johannes Berg [this message]
2016-11-13  5:25     ` Cong Wang
2016-11-13  7:31       ` Johannes Berg
2016-11-13 17:15 ` David Miller
2016-11-14  6:29   ` Cong Wang

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=1478986636.4226.4.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    --cc=tom@herbertland.com \
    --cc=tycho.andersen@canonical.com \
    --cc=weiyongjun1@huawei.com \
    --cc=xiyou.wangcong@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.