[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <84179C81-7C33-4B2E-8B9C-A180E4B679BD@gmail.com>
Date: Fri, 23 Dec 2011 00:49:21 -0500
From: Xi Wang <xi.wang@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Tom Herbert <therbert@...gle.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH v2] rps: fix insufficient bounds checking in store_rps_dev_flow_table_cnt()
On Dec 23, 2011, at 12:16 AM, Eric Dumazet wrote:
> 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.
Okay, seems like we are talking about two different issues here.
1) the truncation of "count" on 64-bit platform.
I don't mind if the user shoots himself in the foot by setting a
large or invalid rps_flow_cnt, as long as the kernel is not affected.
I do agree with you that the kernel could be more friendly and
reject the value rather than picking up part of it. To be nicer
the kernel may even want to reject something like "123abc" that
simple_strtoul() would accept. I am happy to see another patch
fixing that.
2) the bounds checking of the vmalloc() size on 32-bit platform.
I agree that the two checks are ugly. ;-) Do you want to use INT_MAX
in both checks, or do you have something more elegant in mind?
- xi
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists