qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 01/11] iscsi: Fix check for username


From: Paolo Bonzini
Subject: [Qemu-devel] [PULL 01/11] iscsi: Fix check for username
Date: Tue, 10 Mar 2015 11:37:50 +0100

From: Stefan Weil <address@hidden>

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]

Reviewed-by: Peter Lieven <address@hidden>
Acked-by: Peter Lieven <address@hidden>
Signed-off-by: Stefan Weil <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
 block/iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 1fa855a..3e34b1f 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.3.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]