NVMe: fix uninitialized iod compiler warning
Subsystems (2)
PATCH 1/1 NVMe: fix uninitialized iod compiler warning
Signed-off-by Keith Busch <keith.busch at intel.com>
--- drivers/block/nvme.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/nvme.c +1 -1
@@ -1158,7 +1158,7 @@ static int nvme_user_admin_cmd(struct nvme_ns *ns,struct nvme_admin_cmd cmd;struct nvme_command c;int status, length; -struct nvme_iod *iod; +struct nvme_iod *iod =NULL ;if (!capable (CAP_SYS_ADMIN ))return -EACCES ;
Signature · 1 line
1.7.0.4
PATCH 1/1 NVMe: fix uninitialized iod compiler warning
drivers/block/nvme.c static int nvme_user_admin_cmd(struct nvme_ns *ns, · line 1161
Quoted 4 lines · Keith Busch
drivers/block/nvme.c +1
-1int status, length; -struct nvme_iod *iod; +struct nvme_iod *iod =NULL ;
So this is a compiler bug. And it's not present in every compiler version; it didn't occur on my machine until I upgraded gcc recently. There's no way that iod can be used uninitialised. The correct way to indicate this is:
+ struct nvme_iod *uninitialized_var(iod);