[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1376597671.11676.149.camel@deadeye.wl.decadent.org.uk>
Date: Thu, 15 Aug 2013 22:14:31 +0200
From: Ben Hutchings <bhutchings@...arflare.com>
To: David Miller <davem@...emloft.net>
CC: <wpan@...hat.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net] tun: compare with 0 instead of total_len
On Tue, 2013-08-13 at 19:29 -0700, David Miller wrote:
> From: Weiping Pan <wpan@...hat.com>
> Date: Tue, 13 Aug 2013 21:46:56 +0800
>
> > Since we set "len = total_len" in the beginning of tun_get_user(),
> > so we should compare the new len with 0, instead of total_len,
> > or the if statement always returns false.
> >
> > Signed-off-by: Weiping Pan <wpan@...hat.com>
>
> Definitely looks correct to me, applied, thanks.
len is unsigned. So while len > total_len is a poor way of checking for
underflow, len < 0 is much worse!
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
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