]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Fix segmentation if invalid customer id
authorRandy Bates <rbates@web-site.com>
Fri, 22 May 2020 18:21:53 +0000 (13:21 -0500)
committerKeith Busch <kbusch@kernel.org>
Fri, 22 May 2020 18:34:04 +0000 (12:34 -0600)
Attempting to free  unallocated memory

plugins/wdc/wdc-nvme.c

index c28f61653a320b0dbfa090650361884482c674f3..740b6be23549a9708d661e84991f1390b352c0c2 100644 (file)
@@ -3574,6 +3574,7 @@ static int wdc_get_ca_log_page(int fd, char *format)
                } else {
 
                        fprintf(stderr, "ERROR : WDC : Unsupported Customer id, id = %d\n", *cust_id);
+                       return -1;
                }
                break;
 
@@ -3630,12 +3631,14 @@ static int wdc_get_ca_log_page(int fd, char *format)
                } else {
 
                        fprintf(stderr, "ERROR : WDC : Unsupported Customer id, id = %d\n", *cust_id);
+                       return -1;
                }
                break;
 
        default:
 
                fprintf(stderr, "ERROR : WDC : Log page 0xCA not supported for this device\n");
+               return -1;
                break;
        }