[PATCH] fabrics: fix return value of hostnqn_read_file()

Chaitanya Kulkarni chaitanyak at nvidia.com
Tue Sep 7 17:05:01 PDT 2021


On 9/7/21 2:29 PM, Keith Busch wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Sun, Sep 05, 2021 at 05:57:19PM -0700, Chaitanya Kulkarni wrote:
>> @@ -855,7 +855,7 @@ static char *hostnqn_read_file(void)
>>
>>   out:
>>        fclose(f);
>> -     return ret;
>> +     return strcmp(ret, "") == 0 ? NULL : ret;
>>   }
> 
> But if the 'goto out' label is used, you are calling strcmp() with a
> NULL pointer.
> 
> And if "ret" is an emptry string, I think you still need to free() it
> here since it is not being returned anymore.
> 

Let me resend a new patch as this patch is wrong.




More information about the Linux-nvme mailing list