All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	Andy Grover <agrover@redhat.com>, Jesper Juhl <jj@chaosbits.net>,
	Joern Engel <joern@logfs.org>, Roland Dreier <roland@kernel.org>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] iscsi-target: remove some dead code
Date: Thu, 17 May 2012 09:58:40 +0000	[thread overview]
Message-ID: <4FB4CBD0.8000503@bfs.de> (raw)
In-Reply-To: <20120517070814.GD14660@elgon.mountain>



Am 17.05.2012 09:08, schrieb Dan Carpenter:
> Neither "acceptor_values" nor "proposer_values" can be NULL here.
> Smatch complains because we are not allowed to pass NULL pointers to
> strchr().
> 
> Also I removed a second later check for "!acceptor_values" because it
> gets checked on the next line in the do while condition.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Compile tested only.  Please review carefully.
> 
> diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
> index ad3b3c1..ed5241e 100644
> --- a/drivers/target/iscsi/iscsi_target_parameters.c
> +++ b/drivers/target/iscsi/iscsi_target_parameters.c
> @@ -1037,13 +1037,6 @@ static char *iscsi_check_valuelist_for_support(
>  			tmp2 = strchr(acceptor_values, ',');
>  			if (tmp2)
>  				*tmp2 = '\0';
this looks like strchrnul(). I realy do not know is this supported inside the kernel ?



> -			if (!acceptor_values || !proposer_values) {
> -				if (tmp1)
> -					*tmp1 = ',';
> -				if (tmp2)
> -					*tmp2 = ',';
> -				return NULL;
> -			}
>  			if (!strcmp(acceptor_values, proposer_values)) {
>  				if (tmp2)
>  					*tmp2 = ',';
> @@ -1053,8 +1046,6 @@ static char *iscsi_check_valuelist_for_support(
>  				*tmp2++ = ',';
>  
>  			acceptor_values = tmp2;
> -			if (!acceptor_values)
> -				break;
>  		} while (acceptor_values);
>  		if (tmp1)
>  			*tmp1++ = ',';


the changes look reasonable but to be fair the code should have an explanation
what it is supposed to do. I do not have the feeling that i did understand the
purpose completely.

just my 2 cents,
 wh


WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	Andy Grover <agrover@redhat.com>, Jesper Juhl <jj@chaosbits.net>,
	Joern Engel <joern@logfs.org>, Roland Dreier <roland@kernel.org>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] iscsi-target: remove some dead code
Date: Thu, 17 May 2012 11:58:40 +0200	[thread overview]
Message-ID: <4FB4CBD0.8000503@bfs.de> (raw)
In-Reply-To: <20120517070814.GD14660@elgon.mountain>



Am 17.05.2012 09:08, schrieb Dan Carpenter:
> Neither "acceptor_values" nor "proposer_values" can be NULL here.
> Smatch complains because we are not allowed to pass NULL pointers to
> strchr().
> 
> Also I removed a second later check for "!acceptor_values" because it
> gets checked on the next line in the do while condition.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Compile tested only.  Please review carefully.
> 
> diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
> index ad3b3c1..ed5241e 100644
> --- a/drivers/target/iscsi/iscsi_target_parameters.c
> +++ b/drivers/target/iscsi/iscsi_target_parameters.c
> @@ -1037,13 +1037,6 @@ static char *iscsi_check_valuelist_for_support(
>  			tmp2 = strchr(acceptor_values, ',');
>  			if (tmp2)
>  				*tmp2 = '\0';
this looks like strchrnul(). I realy do not know is this supported inside the kernel ?



> -			if (!acceptor_values || !proposer_values) {
> -				if (tmp1)
> -					*tmp1 = ',';
> -				if (tmp2)
> -					*tmp2 = ',';
> -				return NULL;
> -			}
>  			if (!strcmp(acceptor_values, proposer_values)) {
>  				if (tmp2)
>  					*tmp2 = ',';
> @@ -1053,8 +1046,6 @@ static char *iscsi_check_valuelist_for_support(
>  				*tmp2++ = ',';
>  
>  			acceptor_values = tmp2;
> -			if (!acceptor_values)
> -				break;
>  		} while (acceptor_values);
>  		if (tmp1)
>  			*tmp1++ = ',';


the changes look reasonable but to be fair the code should have an explanation
what it is supposed to do. I do not have the feeling that i did understand the
purpose completely.

just my 2 cents,
 wh


  parent reply	other threads:[~2012-05-17  9:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17  7:08 [patch] iscsi-target: remove some dead code Dan Carpenter
2012-05-17  7:08 ` Dan Carpenter
2012-05-17  7:39 ` Nicholas A. Bellinger
2012-05-17  7:39   ` Nicholas A. Bellinger
2012-05-17  9:58 ` walter harms [this message]
2012-05-17  9:58   ` walter harms
2012-05-17 10:26   ` Dan Carpenter
2012-05-17 10:26     ` Dan Carpenter
2012-05-17 15:15   ` Jörn Engel
2012-05-17 15:15     ` Jörn Engel
2012-05-17 10:30 ` walter harms
2012-05-17 11:55 ` Dan Carpenter

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=4FB4CBD0.8000503@bfs.de \
    --to=wharms@bfs.de \
    --cc=agrover@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jj@chaosbits.net \
    --cc=joern@logfs.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=roland@kernel.org \
    /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.