All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Stefan Weil <sw@weilnetz.de>, QEMU Trivial <qemu-trivial@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	QEMU Developer <qemu-devel@nongnu.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: Re: [Qemu-trivial] [PATCH] iscsi: Fix check for username
Date: Sat, 07 Mar 2015 21:00:16 +0100	[thread overview]
Message-ID: <54FB58D0.3070400@kamp.de> (raw)
In-Reply-To: <1425719670-5486-1-git-send-email-sw@weilnetz.de>

Am 07.03.2015 um 10:14 schrieb Stefan Weil:
> 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 <sw@weilnetz.de>
> ---
>
> 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) {

Thanks for catching this. Luckily this call is before the parse_chap function. Otherwise
it would have been impossible to specify username and password via config file.

Reviewed-by: Peter Lieven <pl@kamp.de>
Acked-by: Peter Lieven <pl@kamp.de>


WARNING: multiple messages have this Message-ID (diff)
From: Peter Lieven <pl@kamp.de>
To: Stefan Weil <sw@weilnetz.de>, QEMU Trivial <qemu-trivial@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	QEMU Developer <qemu-devel@nongnu.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] iscsi: Fix check for username
Date: Sat, 07 Mar 2015 21:00:16 +0100	[thread overview]
Message-ID: <54FB58D0.3070400@kamp.de> (raw)
In-Reply-To: <1425719670-5486-1-git-send-email-sw@weilnetz.de>

Am 07.03.2015 um 10:14 schrieb Stefan Weil:
> 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 <sw@weilnetz.de>
> ---
>
> 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) {

Thanks for catching this. Luckily this call is before the parse_chap function. Otherwise
it would have been impossible to specify username and password via config file.

Reviewed-by: Peter Lieven <pl@kamp.de>
Acked-by: Peter Lieven <pl@kamp.de>

  reply	other threads:[~2015-03-08  7:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07  9:14 [Qemu-trivial] [PATCH] iscsi: Fix check for username Stefan Weil
2015-03-07  9:14 ` [Qemu-devel] " Stefan Weil
2015-03-07 20:00 ` Peter Lieven [this message]
2015-03-07 20:00   ` Peter Lieven
2015-03-09 16:26 ` [Qemu-trivial] " Paolo Bonzini
2015-03-09 16:26   ` [Qemu-devel] " Paolo Bonzini

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=54FB58D0.3070400@kamp.de \
    --to=pl@kamp.de \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.