qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] iscsi: Fix check for username
@ 2015-03-07  9:14 Stefan Weil
  2015-03-07 20:00 ` Peter Lieven
  2015-03-09 16:26 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2015-03-07  9:14 UTC (permalink / raw)
  To: QEMU Trivial
  Cc: Kevin Wolf, Ronnie Sahlberg, Stefan Weil, Peter Lieven,
	QEMU Developer, Stefan Hajnoczi, Paolo Bonzini

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) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] iscsi: Fix check for username
  2015-03-07  9:14 [Qemu-devel] [PATCH] iscsi: Fix check for username Stefan Weil
@ 2015-03-07 20:00 ` Peter Lieven
  2015-03-09 16:26 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Lieven @ 2015-03-07 20:00 UTC (permalink / raw)
  To: Stefan Weil, QEMU Trivial
  Cc: Kevin Wolf, Paolo Bonzini, Stefan Hajnoczi, QEMU Developer,
	Ronnie Sahlberg

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] iscsi: Fix check for username
  2015-03-07  9:14 [Qemu-devel] [PATCH] iscsi: Fix check for username Stefan Weil
  2015-03-07 20:00 ` Peter Lieven
@ 2015-03-09 16:26 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-03-09 16:26 UTC (permalink / raw)
  To: Stefan Weil, QEMU Trivial
  Cc: Kevin Wolf, Stefan Hajnoczi, Peter Lieven, QEMU Developer,
	Ronnie Sahlberg



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 <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) {
> 

Applied, thanks.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-09 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-07  9:14 [Qemu-devel] [PATCH] iscsi: Fix check for username Stefan Weil
2015-03-07 20:00 ` Peter Lieven
2015-03-09 16:26 ` Paolo Bonzini

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).