From: Laurent Vivier <laurent@vivier.eu>
To: Chen Qun <kuhn.chenqun@huawei.com>,
qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: Fam Zheng <fam@euphon.net>, Hannes Reinecke <hare@suse.com>,
zhang.zhanghailiang@huawei.com, qemu-block@nongnu.org,
Euler Robot <euler.robot@huawei.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] hw/scsi/megasas:Clean up some redundant code fix Clang warnings
Date: Tue, 10 Mar 2020 16:01:24 +0100 [thread overview]
Message-ID: <bccf78b8-4c63-1587-742c-2595fe78e632@vivier.eu> (raw)
In-Reply-To: <20200310130844.30076-1-kuhn.chenqun@huawei.com>
Le 10/03/2020 à 14:08, Chen Qun a écrit :
> Here are some redundant statements, we can clean them up.
> Clang static code analyzer show warning:
> hw/scsi/megasas.c:1175:32: warning: Value stored to 'max_ld_disks' during its initialization is never read
> uint32_t num_ld_disks = 0, max_ld_disks = s->fw_luns;
> ^~~~~~~~~~~~ ~~~~~~~~~~
> hw/scsi/megasas.c:1183:9: warning: Value stored to 'max_ld_disks' is never read
> max_ld_disks = 0;
> ^ ~
This has been introduced by:
d97ae3684863 ("megasas: fixup MFI_DCMD_LD_LIST_QUERY")
And modified by:
commit 3f2cd4dd47719497540fb0e0aa0635e127f2838f
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Oct 29 13:00:07 2014 +0100
megasas: fixup device mapping
Logical drives can only be addressed with the 'target_id' number;
LUN numbers cannot be selected.
Physical drives can be selected with both, target and LUN id.
So we should disallow LUN numbers not equal to 0 when in
RAID mode.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
...
@@ -1143,10 +1152,13 @@ static int
megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
return MFI_STAT_INVALID_PARAMETER;
}
dcmd_size = sizeof(uint32_t) * 2 + 3;
-
+ max_ld_disks = cmd->iov_size - dcmd_size;
if (megasas_is_jbod(s)) {
max_ld_disks = 0;
}
+ if (max_ld_disks > MFI_MAX_LD) {
+ max_ld_disks = MFI_MAX_LD;
+ }
QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) {
SCSIDevice *sdev = DO_UPCAST(SCSIDevice, qdev, kid->child);
...
Thanks,
Laurent
next prev parent reply other threads:[~2020-03-10 15:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 13:08 [PATCH] hw/scsi/megasas:Clean up some redundant code fix Clang warnings Chen Qun
2020-03-10 13:46 ` Peter Maydell
2020-03-10 15:04 ` Laurent Vivier
2020-03-11 1:10 ` Chenqun (kuhn)
2020-03-10 13:58 ` no-reply
2020-03-10 15:01 ` Laurent Vivier [this message]
2020-03-11 6:48 ` Chenqun (kuhn)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bccf78b8-4c63-1587-742c-2595fe78e632@vivier.eu \
--to=laurent@vivier.eu \
--cc=euler.robot@huawei.com \
--cc=fam@euphon.net \
--cc=hare@suse.com \
--cc=kuhn.chenqun@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).