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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 5 Jan 2007 00:32:31 -0200 From: "Arnaldo Carvalho de Melo" <arnaldo.melo@...il.com> To: "David Miller" <davem@...emloft.net> Cc: paul.moore@...com, netdev@...r.kernel.org Subject: Re: [PATCH] INET: fix incorrect "inet_sock->is_icsk" assignment On 1/4/07, David Miller <davem@...emloft.net> wrote: > From: "Paul Moore" <paul.moore@...com> > Date: Thu, 04 Jan 2007 15:04:31 -0500 > > > From: Paul Moore <paul.moore@...com> > > > > The inet_create() and inet6_create() functions incorrectly set the > > inet_sock->is_icsk field. Both functions assume that the is_icsk field is > > large enough to hold at least a INET_PROTOSW_ICSK value when it is actually > > only a single bit. This patch corrects the assignment by doing a boolean > > comparison whose result will safely fit into a single bit field. > > > > Signed-off-by: Paul Moore <paul.moore@...com> > > Applied, thanks a lot Paul. Well spotted, gcc let me down on this one: [acme@...toy ~]$ cat a.c #include <stdio.h> struct foo { int a_bit:1; }; int main(void) { int trickme = 0x04; struct foo oof; oof.a_bit = trickme & 4; printf("%u\n", oof.a_bit); } [acme@...toy ~]$ make a cc a.c -o a [acme@...toy ~]$ ./a 0 [acme@...toy ~]$ But... [acme@...toy ~]$ cat a.c #include <stdio.h> struct foo { int a_bit:1; }; int main(void) { struct foo oof; oof.a_bit = 0x04; printf("%u\n", oof.a_bit); } [acme@...toy ~]$ make a cc a.c -o a a.c: In function 'main': a.c:8: warning: overflow in implicit constant conversion [acme@...toy ~]$ I expected a warning since the and operation clearly could yield a value that would overflow, just like in the constant case... Anyway, thanks a lot Paul! - Arnaldo - 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