From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr710104.outbound.protection.outlook.com ([40.107.71.104]:46976 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730550AbeIXUwM (ORCPT ); Mon, 24 Sep 2018 16:52:12 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Greentime Hu , Sasha Levin Subject: [PATCH AUTOSEL 4.18 66/76] nds32: fix logic for module Date: Mon, 24 Sep 2018 14:48:40 +0000 Message-ID: <20180924144751.164410-65-alexander.levin@microsoft.com> References: <20180924144751.164410-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Greentime Hu [ Upstream commit 1dfdf99106668679b0de5a62fd4f42c1a11c9445 ] 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 Fixes: c9a4a8da6baa ("nds32: Loadable modules") Signed-off-by: Greentime Hu Signed-off-by: Sasha Levin --- arch/nds32/kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/nds32/kernel/module.c b/arch/nds32/kernel/module.c index 4167283d8293..1e31829cbc2a 100644 --- a/arch/nds32/kernel/module.c +++ b/arch/nds32/kernel/module.c @@ -40,7 +40,7 @@ void do_reloc16(unsigned int val, unsigned int *loc, unsi= gned int val_mask, =20 tmp2 =3D tmp & loc_mask; if (partial_in_place) { - tmp &=3D (!loc_mask); + tmp &=3D (~loc_mask); tmp =3D tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); } else { @@ -70,7 +70,7 @@ void do_reloc32(unsigned int val, unsigned int *loc, unsi= gned int val_mask, =20 tmp2 =3D tmp & loc_mask; if (partial_in_place) { - tmp &=3D (!loc_mask); + tmp &=3D (~loc_mask); tmp =3D tmp2 | ((tmp + ((val & val_mask) >> val_shift)) & val_mask); } else { --=20 2.17.1