[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190528142424.19626-2-geert@linux-m68k.org>
Date: Tue, 28 May 2019 16:24:20 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Igor Konopko <igor.j.konopko@...el.com>,
David Howells <dhowells@...hat.com>,
"Mohit P . Tahiliani" <tahiliani@...k.edu.in>,
Takashi Sakamoto <o-takashi@...amocchi.jp>,
Eran Ben Elisha <eranbe@...lanox.com>,
Matias Bjorling <mb@...htnvm.io>,
Jiri Pirko <jiri@...lanox.com>,
"David S . Miller" <davem@...emloft.net>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Clemens Ladisch <clemens@...isch.de>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Joe Perches <joe@...ches.com>,
Arnd Bergmann <arnd@...db.de>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: linux-block@...r.kernel.org, netdev@...r.kernel.org,
linux-afs@...ts.infradead.org, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH 1/5] lightnvm: Fix uninitialized pointer in nvm_remove_tgt()
With gcc 4.1:
drivers/lightnvm/core.c: In function ‘nvm_remove_tgt’:
drivers/lightnvm/core.c:510: warning: ‘t’ is used uninitialized in this function
Indeed, if no NVM devices have been registered, t will be an
uninitialized pointer, and may be dereferenced later. A call to
nvm_remove_tgt() can be triggered from userspace by issuing the
NVM_DEV_REMOVE ioctl on the lightnvm control device.
Fix this by preinitializing t to NULL.
Fixes: 843f2edbdde085b4 ("lightnvm: do not remove instance under global lock")
Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
drivers/lightnvm/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 0df7454832efe082..aa017f48eb8c588c 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -492,7 +492,7 @@ static void __nvm_remove_target(struct nvm_target *t, bool graceful)
*/
static int nvm_remove_tgt(struct nvm_ioctl_remove *remove)
{
- struct nvm_target *t;
+ struct nvm_target *t = NULL;
struct nvm_dev *dev;
down_read(&nvm_lock);
--
2.17.1
Powered by blists - more mailing lists