From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUKtg-00044h-O1 for qemu-devel@nongnu.org; Sat, 07 Mar 2015 15:00:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUKtc-00043y-Em for qemu-devel@nongnu.org; Sat, 07 Mar 2015 15:00:28 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:60864 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUKtc-00043W-42 for qemu-devel@nongnu.org; Sat, 07 Mar 2015 15:00:24 -0500 Message-ID: <54FB58D0.3070400@kamp.de> Date: Sat, 07 Mar 2015 21:00:16 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1425719670-5486-1-git-send-email-sw@weilnetz.de> In-Reply-To: <1425719670-5486-1-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] iscsi: Fix check for username List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 > --- > > 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 Acked-by: Peter Lieven