[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] iscsi: Fix check for username
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] iscsi: Fix check for username |
Date: |
Mon, 09 Mar 2015 17:26:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 07/03/2015 10:14, Stefan Weil wrote:
> The variable user in struct iscsi_url is a character array, not a pointer.
> Therefore its address will never be NULL.
>
> clang reports this error:
>
> block/iscsi.c:1329:20: warning:
> comparison of array 'iscsi_url->user' not equal to a null pointer
> is always true [-Wtautological-pointer-compare]
>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>
> This error also exists in libscsi. See my pull request
> https://github.com/sahlberg/libiscsi/pull/146
>
> Cheers
> Stefan
>
> block/iscsi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 1fa855a..a2bd70a 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -1326,7 +1326,7 @@ static int iscsi_open(BlockDriverState *bs, QDict
> *options, int flags,
> goto out;
> }
>
> - if (iscsi_url->user != NULL) {
> + if (iscsi_url->user[0] != '\0') {
> ret = iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user,
> iscsi_url->passwd);
> if (ret != 0) {
>
Applied, thanks.
Paolo