Thread (3 messages) 3 messages, 2 authors, 2021-09-08

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

From: Keith Busch <kbusch@kernel.org>
Date: 2021-09-07 21:30:09

On Sun, Sep 05, 2021 at 05:57:19PM -0700, Chaitanya Kulkarni wrote:
quoted hunk ↗ jump to hunk
@@ -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.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help