projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4cffbec
)
include/bitfield.h: Assure new bitfield value doesn't touch unwanted bits
author
Codrin Ciubotariu
<codrin.ciubotariu@freescale.com>
Fri, 24 Jul 2015 13:52:19 +0000
(16:52 +0300)
committer
Tom Rini
<trini@konsulko.com>
Thu, 13 Aug 2015 00:47:44 +0000
(20:47 -0400)
The new bitfield value must not be higher than its mask.
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
include/bitfield.h
patch
|
blob
|
history
diff --git
a/include/bitfield.h
b/include/bitfield.h
index ec4815c8e05179508c00cce24655acd7382ba62e..b884c7460013faab98010d48b08952c77287683d 100644
(file)
--- a/
include/bitfield.h
+++ b/
include/bitfield.h
@@
-54,5
+54,5
@@
static inline uint bitfield_replace(uint reg_val, uint shift, uint width,
{
uint mask = bitfield_mask(shift, width);
- return (reg_val & ~mask) | (
bitfield_val << shift
);
+ return (reg_val & ~mask) | (
(bitfield_val << shift) & mask
);
}