* [linux-nvme:nvme-5.19] BUILD SUCCESS WITH WARNING 4db675888cdb7b24812e289d7f90e7928dd400a3
@ 2022-06-30 5:58 kernel test robot
2022-06-30 6:24 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-06-30 5:58 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-nvme
tree/branch: git://git.infradead.org/nvme.git nvme-5.19
branch HEAD: 4db675888cdb7b24812e289d7f90e7928dd400a3 nvmet: add a clear_ids attribute for passthru targets
Warning: (recently discovered and may have been fixed)
drivers/nvme/target/passthru.c:54:16: warning: variable 'csi_seen' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
drivers/nvme/target/passthru.c:57:7: warning: variable 'csi_seen' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
Warning ids grouped by kconfigs:
clang_recent_errors
|-- arm-randconfig-r015-20220629
| |-- drivers-nvme-target-passthru.c:warning:variable-csi_seen-is-used-uninitialized-whenever-for-loop-exits-because-its-condition-is-false
| `-- drivers-nvme-target-passthru.c:warning:variable-csi_seen-is-used-uninitialized-whenever-if-condition-is-true
`-- x86_64-randconfig-a014
|-- drivers-nvme-target-passthru.c:warning:variable-csi_seen-is-used-uninitialized-whenever-for-loop-exits-because-its-condition-is-false
`-- drivers-nvme-target-passthru.c:warning:variable-csi_seen-is-used-uninitialized-whenever-if-condition-is-true
elapsed time: 723m
configs tested: 52
configs skipped: 2
gcc tested configs:
arm defconfig
arm allyesconfig
arm64 allyesconfig
ia64 allmodconfig
mips allyesconfig
powerpc allmodconfig
powerpc allnoconfig
sh allmodconfig
i386 defconfig
i386 allyesconfig
arc allyesconfig
alpha allyesconfig
m68k allmodconfig
m68k allyesconfig
x86_64 randconfig-a004
x86_64 randconfig-a002
x86_64 randconfig-a006
i386 randconfig-a001
i386 randconfig-a003
i386 randconfig-a005
x86_64 randconfig-a013
x86_64 randconfig-a011
x86_64 randconfig-a015
i386 randconfig-a014
i386 randconfig-a012
i386 randconfig-a016
arc randconfig-r043-20220629
s390 randconfig-r044-20220629
riscv randconfig-r042-20220629
um i386_defconfig
um x86_64_defconfig
x86_64 rhel-8.3-kselftests
x86_64 rhel-8.3-func
x86_64 rhel-8.3-kunit
x86_64 rhel-8.3-syz
x86_64 defconfig
x86_64 allyesconfig
x86_64 rhel-8.3
clang tested configs:
x86_64 randconfig-a005
x86_64 randconfig-a001
x86_64 randconfig-a003
i386 randconfig-a002
i386 randconfig-a004
i386 randconfig-a006
x86_64 randconfig-a012
x86_64 randconfig-a014
x86_64 randconfig-a016
i386 randconfig-a013
i386 randconfig-a015
i386 randconfig-a011
hexagon randconfig-r041-20220629
hexagon randconfig-r045-20220629
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-nvme:nvme-5.19] BUILD SUCCESS WITH WARNING 4db675888cdb7b24812e289d7f90e7928dd400a3
2022-06-30 5:58 [linux-nvme:nvme-5.19] BUILD SUCCESS WITH WARNING 4db675888cdb7b24812e289d7f90e7928dd400a3 kernel test robot
@ 2022-06-30 6:24 ` Christoph Hellwig
2022-06-30 16:54 ` Alan Adamson
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2022-06-30 6:24 UTC (permalink / raw)
To: kernel test robot; +Cc: Christoph Hellwig, linux-nvme, Alan Adamson
On Thu, Jun 30, 2022 at 01:58:42PM +0800, kernel test robot wrote:
> tree/branch: git://git.infradead.org/nvme.git nvme-5.19
> branch HEAD: 4db675888cdb7b24812e289d7f90e7928dd400a3 nvmet: add a clear_ids attribute for passthru targets
>
> Warning: (recently discovered and may have been fixed)
>
> drivers/nvme/target/passthru.c:54:16: warning: variable 'csi_seen' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
> drivers/nvme/target/passthru.c:57:7: warning: variable 'csi_seen' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
I ended up fixing this with the patch below. Alan, let me know
if this works for you:
diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
index d71ed297ad16b..6f39a29828b12 100644
--- a/drivers/nvme/target/passthru.c
+++ b/drivers/nvme/target/passthru.c
@@ -33,10 +33,9 @@ void nvmet_passthrough_override_cap(struct nvmet_ctrl *ctrl)
static u16 nvmet_passthru_override_id_descs(struct nvmet_req *req)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
- struct nvme_ns_id_desc *cur;
u16 status = NVME_SC_SUCCESS;
int pos, len;
- bool csi_seen;
+ bool csi_seen = false;
void *data;
u8 csi;
@@ -52,26 +51,25 @@ static u16 nvmet_passthru_override_id_descs(struct nvmet_req *req)
goto out_free;
for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE; pos += len) {
- cur = data + pos;
+ struct nvme_ns_id_desc *cur = data + pos;
if (cur->nidl == 0)
break;
- len = cur->nidl;
if (cur->nidt == NVME_NIDT_CSI) {
- memcpy(&csi, data + pos + sizeof(struct nvme_ns_id_desc),
- NVME_NIDT_CSI_LEN);
- csi_seen = 1;
+ memcpy(&csi, cur + 1, NVME_NIDT_CSI_LEN);
+ csi_seen = true;
break;
}
- len += sizeof(struct nvme_ns_id_desc);
+ len = sizeof(struct nvme_ns_id_desc) + cur->nidl;
}
memset(data, 0, NVME_IDENTIFY_DATA_SIZE);
if (csi_seen) {
- cur = data;
+ struct nvme_ns_id_desc *cur = data;
+
cur->nidt = NVME_NIDT_CSI;
cur->nidl = NVME_NIDT_CSI_LEN;
- memcpy(data + sizeof(struct nvme_ns_id_desc), &csi, NVME_NIDT_CSI_LEN);
+ memcpy(cur + 1, &csi, NVME_NIDT_CSI_LEN);
}
status = nvmet_copy_to_sgl(req, 0, data, NVME_IDENTIFY_DATA_SIZE);
out_free:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [linux-nvme:nvme-5.19] BUILD SUCCESS WITH WARNING 4db675888cdb7b24812e289d7f90e7928dd400a3
2022-06-30 6:24 ` Christoph Hellwig
@ 2022-06-30 16:54 ` Alan Adamson
0 siblings, 0 replies; 3+ messages in thread
From: Alan Adamson @ 2022-06-30 16:54 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: kernel test robot, linux-nvme@lists.infradead.org
> On Jun 29, 2022, at 11:24 PM, Christoph Hellwig <hch@lst.de> wrote:
>
> On Thu, Jun 30, 2022 at 01:58:42PM +0800, kernel test robot wrote:
>> tree/branch: git://git.infradead.org/nvme.git nvme-5.19
>> branch HEAD: 4db675888cdb7b24812e289d7f90e7928dd400a3 nvmet: add a clear_ids attribute for passthru targets
>>
>> Warning: (recently discovered and may have been fixed)
>>
>> drivers/nvme/target/passthru.c:54:16: warning: variable 'csi_seen' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
>> drivers/nvme/target/passthru.c:57:7: warning: variable 'csi_seen' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>
> I ended up fixing this with the patch below. Alan, let me know
> if this works for you:
Looks good. I tested with my environment.
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
>
> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
> index d71ed297ad16b..6f39a29828b12 100644
> --- a/drivers/nvme/target/passthru.c
> +++ b/drivers/nvme/target/passthru.c
> @@ -33,10 +33,9 @@ void nvmet_passthrough_override_cap(struct nvmet_ctrl *ctrl)
> static u16 nvmet_passthru_override_id_descs(struct nvmet_req *req)
> {
> struct nvmet_ctrl *ctrl = req->sq->ctrl;
> - struct nvme_ns_id_desc *cur;
> u16 status = NVME_SC_SUCCESS;
> int pos, len;
> - bool csi_seen;
> + bool csi_seen = false;
> void *data;
> u8 csi;
>
> @@ -52,26 +51,25 @@ static u16 nvmet_passthru_override_id_descs(struct nvmet_req *req)
> goto out_free;
>
> for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE; pos += len) {
> - cur = data + pos;
> + struct nvme_ns_id_desc *cur = data + pos;
>
> if (cur->nidl == 0)
> break;
> - len = cur->nidl;
> if (cur->nidt == NVME_NIDT_CSI) {
> - memcpy(&csi, data + pos + sizeof(struct nvme_ns_id_desc),
> - NVME_NIDT_CSI_LEN);
> - csi_seen = 1;
> + memcpy(&csi, cur + 1, NVME_NIDT_CSI_LEN);
> + csi_seen = true;
> break;
> }
> - len += sizeof(struct nvme_ns_id_desc);
> + len = sizeof(struct nvme_ns_id_desc) + cur->nidl;
> }
>
> memset(data, 0, NVME_IDENTIFY_DATA_SIZE);
> if (csi_seen) {
> - cur = data;
> + struct nvme_ns_id_desc *cur = data;
> +
> cur->nidt = NVME_NIDT_CSI;
> cur->nidl = NVME_NIDT_CSI_LEN;
> - memcpy(data + sizeof(struct nvme_ns_id_desc), &csi, NVME_NIDT_CSI_LEN);
> + memcpy(cur + 1, &csi, NVME_NIDT_CSI_LEN);
> }
> status = nvmet_copy_to_sgl(req, 0, data, NVME_IDENTIFY_DATA_SIZE);
> out_free:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-30 16:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30 5:58 [linux-nvme:nvme-5.19] BUILD SUCCESS WITH WARNING 4db675888cdb7b24812e289d7f90e7928dd400a3 kernel test robot
2022-06-30 6:24 ` Christoph Hellwig
2022-06-30 16:54 ` Alan Adamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox