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: Thu, 17 Jul 2014 09:51:33 +0000 From: David Laight <David.Laight@...LAB.COM> To: 'Will Deacon' <will.deacon@....com>, Zi Shen Lim <zlim.lnx@...il.com> CC: Catalin Marinas <Catalin.Marinas@....com>, Jiang Liu <liuj97@...il.com>, AKASHI Takahiro <takahiro.akashi@...aro.org>, "David S. Miller" <davem@...emloft.net>, Daniel Borkmann <dborkman@...hat.com>, "Alexei Starovoitov" <ast@...mgrid.com>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org> Subject: RE: [PATCH RFCv3 08/14] arm64: introduce aarch64_insn_gen_movewide() From: Will Deacon ... > > > > + BUG_ON(imm < 0 || imm > 65535); > > > > > > Do this check with masking instead? > > > > Ok, if you prefer, I can change it to: > > > > BUG_ON(imm & ~GENMASK(15, 0)); Gah - then anyone reading the code has to look up another define. There isn't a prize for the most complicated method of defining a constant that can never change. > Sure, that or use a named constant for the upper-bound (SZ_64K - 1). There is nothing wrong with the original code. Maybe use 0xffff for those people (are there any) that don't know their powers of two. These are strong constants, they aren't going to be changed to any other value, and it is unlikely that anyone will want to search for their uses. I presume that SZ_64K is defined somewhere to 0x10000u. But IMHO using it (instead of the literal) doesn't make code any more readable. David -- 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