lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1381251080.2081.243.camel@joe-AO722>
Date:	Tue, 08 Oct 2013 09:51:20 -0700
From:	Joe Perches <joe@...ches.com>
To:	Richard Weinberger <richard.weinberger@...il.com>
Cc:	Anatol Pomozov <anatol.pomozov@...il.com>,
	LKML <linux-kernel@...r.kernel.org>, rdunlap@...radead.org
Subject: Re: [PATCH] core: Catch overflows in do_div() function

On Tue, 2013-10-08 at 18:45 +0200, Richard Weinberger wrote:
> On Tue, Oct 8, 2013 at 6:18 PM, Joe Perches <joe@...ches.com> wrote:
> > On Tue, 2013-10-08 at 09:10 -0700, Anatol Pomozov wrote:
> >> If second parameter passed to this function was 64 then it silently
> >> truncates to 32 bits. Catch such situation.
> > []
> >> diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h
> > []
> >> @@ -25,6 +26,7 @@
> >>  # define do_div(n,base) ({                                   \
> >>       uint32_t __base = (base);                               \
> >>       uint32_t __rem;                                         \
> >> +     BUG_ON(sizeof(base) > 4 && base >= (1UL<<32));          \
> >
> > I think this would be better as a BUILD_BUG_ON
> 
> No. BUILD_BUG_ON works only for constants.

Add __builtin_constant_p(base).


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ