Skip to content

Commit

Permalink
nds32: fix logic for module
Browse files Browse the repository at this point in the history
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: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: c9a4a8d ("nds32: Loadable modules")
Signed-off-by: Greentime Hu <greentime@andestech.com>
  • Loading branch information
Greentime Hu committed Sep 4, 2018
1 parent 5736184 commit 1dfdf99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/nds32/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void do_reloc16(unsigned int val, unsigned int *loc, unsigned int val_mask,

tmp2 = tmp & loc_mask;
if (partial_in_place) {
tmp &= (!loc_mask);
tmp &= (~loc_mask);
tmp =
tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask);
} else {
Expand Down Expand Up @@ -70,7 +70,7 @@ void do_reloc32(unsigned int val, unsigned int *loc, unsigned int val_mask,

tmp2 = tmp & loc_mask;
if (partial_in_place) {
tmp &= (!loc_mask);
tmp &= (~loc_mask);
tmp =
tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask);
} else {
Expand Down

0 comments on commit 1dfdf99

Please sign in to comment.