Commit 1dfdf991 authored by Greentime Hu's avatar Greentime Hu

nds32: fix logic for module

This bug is report by Dan Carpenter. We shall use ~loc_mask instead of
!loc_mask because we need to and(&) the bits of ~loc_mask.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: c9a4a8da ("nds32: Loadable modules")
Signed-off-by: default avatarGreentime Hu <greentime@andestech.com>
parent 57361846
...@@ -40,7 +40,7 @@ void do_reloc16(unsigned int val, unsigned int *loc, unsigned int val_mask, ...@@ -40,7 +40,7 @@ void do_reloc16(unsigned int val, unsigned int *loc, unsigned int val_mask,
tmp2 = tmp & loc_mask; tmp2 = tmp & loc_mask;
if (partial_in_place) { if (partial_in_place) {
tmp &= (!loc_mask); tmp &= (~loc_mask);
tmp = tmp =
tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask);
} else { } else {
...@@ -70,7 +70,7 @@ void do_reloc32(unsigned int val, unsigned int *loc, unsigned int val_mask, ...@@ -70,7 +70,7 @@ void do_reloc32(unsigned int val, unsigned int *loc, unsigned int val_mask,
tmp2 = tmp & loc_mask; tmp2 = tmp & loc_mask;
if (partial_in_place) { if (partial_in_place) {
tmp &= (!loc_mask); tmp &= (~loc_mask);
tmp = tmp =
tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment