All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-4.4-rc8/arch/arm64/kernel/module.c:78: 32/64 bit problem ?
@ 2016-01-04  8:25 David Binderman
  2016-01-04 14:16 ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: David Binderman @ 2016-01-04  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hello there,

[linux-4.4-rc8/arch/arm64/kernel/module.c:78] -> [linux-4.4-rc8/arch/arm64/kernel/module.c:88]: (warning) Shifting 32-bit value by 64 bits is undefined behaviour. See condition at line 88.

Source code is

??? u64 imm_mask = (1 << len) - 1;
??? s64 sval = do_reloc(op, place, val);

??? switch (len) {
??? case 16:
??????? *(s16 *)place = sval;
??????? break;
??? case 32:
??????? *(s32 *)place = sval;
??????? break;
??? case 64:

So it seems that len can be 64. Suggest new code

??? u64 imm_mask = (1UL << len) - 1;
??? s64 sval = do_reloc(op, place, val);

??? switch (len) {
??? case 16:
??????? *(s16 *)place = sval;
??????? break;
??? case 32:
??????? *(s32 *)place = sval;
??????? break;
??? case 64:

Regards

David Binderman

 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-04 15:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04  8:25 linux-4.4-rc8/arch/arm64/kernel/module.c:78: 32/64 bit problem ? David Binderman
2016-01-04 14:16 ` Will Deacon
2016-01-04 14:32   ` Ard Biesheuvel
2016-01-04 15:24     ` Ard Biesheuvel
2016-01-04 15:28       ` Will Deacon
2016-01-04 15:30         ` Will Deacon
2016-01-04 15:14   ` David Binderman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.