Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Xi Wang <xi.wang@gmail.com>
Cc: Tom Herbert <therbert@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2] rps: fix insufficient bounds checking in store_rps_dev_flow_table_cnt()
Date: Fri, 23 Dec 2011 06:16:30 +0100	[thread overview]
Message-ID: <1324617390.2674.13.camel@edumazet-laptop> (raw)
In-Reply-To: <ACB00AE8-CFEF-4535-9242-1B5C44F05C13@gmail.com>

Le vendredi 23 décembre 2011 à 00:10 -0500, Xi Wang a écrit :
> On Dec 22, 2011, at 11:53 PM, Eric Dumazet wrote:
> > All I wanted to say is that while mixing INT_MAX/ULONG_MAX, you could
> > have spotted the other bug in the code :
> > 
> > unsigned int count;
> > 
> > count = simple_strtoul(buf, &endp, 0);
> 
> Are you suggesting to change the type of "count" to unsigned long?
> That seems like a separate issue from the bounds checking part.
> 
> I don't see the possible 32-bit truncation here is a serious issue though.
> The user could even echo "128abc" into rps_flow_cnt and simple_strtoul()
> would be happy to pick 128.
> 

32 bit truncation _is_ a bound checking problem too.

Really, mixing INT_MAX / ULONG_MAX is ugly, this should had ring a bell
when writing such hard to read code.

You cannot claim to give more range to 64bit platform, yet not spotting
the 32bit truncation issue.

When fixing a bug, its always a good thing to look things around, and
try to check the whole function.

  reply	other threads:[~2011-12-23  5:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 18:50 [PATCH] rps: fix insufficient bounds checking in store_rps_dev_flow_table_cnt() Xi Wang
2011-12-21 19:22 ` Eric Dumazet
2011-12-21 19:41   ` David Miller
2011-12-21 23:41     ` Xi Wang
2011-12-22 23:35 ` [PATCH v2] " Xi Wang
2011-12-23  3:37   ` David Miller
2011-12-23  4:10   ` Eric Dumazet
2011-12-23  4:44     ` Xi Wang
2011-12-23  4:53       ` Eric Dumazet
2011-12-23  5:10         ` Xi Wang
2011-12-23  5:16           ` Eric Dumazet [this message]
2011-12-23  5:35             ` Eric Dumazet
2011-12-23  5:56               ` Xi Wang
2011-12-23 13:06                 ` Eric Dumazet
2011-12-23 14:30                   ` Xi Wang
2011-12-23 14:53                     ` Eric Dumazet
2011-12-23 15:07                       ` Xi Wang
2011-12-24 16:56                         ` [PATCH net-next] rfs: better sizing of dev_flow_table Eric Dumazet
2011-12-24 21:19                           ` David Miller
2011-12-23  5:49             ` [PATCH v2] rps: fix insufficient bounds checking in store_rps_dev_flow_table_cnt() Xi 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=1324617390.2674.13.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    --cc=xi.wang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox