Re: [PATCH 04/19] Convert a strncmp() call into a strcmp() call

2017-08-25 Thread Hannes Reinecke
On 08/23/2017 11:39 PM, Bart Van Assche wrote:
> This patch avoids that smatch reports the following warning:
> 
> drivers/scsi/scsi_sysfs.c:117: check_set() error: strncmp() '"-"' too small 
> (2 vs 20)
> 
> Signed-off-by: Bart Van Assche 
> Cc: Christoph Hellwig 
> Cc: Hannes Reinecke 
> Cc: Johannes Thumshirn 
> ---
>  drivers/scsi/scsi_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 41891db20108..5ed473a87589 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -114,7 +114,7 @@ static int check_set(unsigned long long *val, char *src)
>  {
>   char *last;
>  
> - if (strncmp(src, "-", 20) == 0) {
> + if (strcmp(src, "-") == 0) {
>   *val = SCAN_WILD_CARD;
>   } else {
>   /*
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 04/19] Convert a strncmp() call into a strcmp() call

2017-08-24 Thread Christoph Hellwig
Looks fine,

Reviewed-by: Christoph Hellwig 


[PATCH 04/19] Convert a strncmp() call into a strcmp() call

2017-08-23 Thread Bart Van Assche
This patch avoids that smatch reports the following warning:

drivers/scsi/scsi_sysfs.c:117: check_set() error: strncmp() '"-"' too small (2 
vs 20)

Signed-off-by: Bart Van Assche 
Cc: Christoph Hellwig 
Cc: Hannes Reinecke 
Cc: Johannes Thumshirn 
---
 drivers/scsi/scsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 41891db20108..5ed473a87589 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -114,7 +114,7 @@ static int check_set(unsigned long long *val, char *src)
 {
char *last;
 
-   if (strncmp(src, "-", 20) == 0) {
+   if (strcmp(src, "-") == 0) {
*val = SCAN_WILD_CARD;
} else {
/*
-- 
2.14.0