linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target: fix a missing check for match_int
@ 2018-12-26  6:48 Kangjie Lu
  2019-01-11 20:06 ` Mike Christie
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2018-12-26  6:48 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Nicholas A. Bellinger, linux-scsi, target-devel,
	linux-kernel

When match_int fails, "arg" is left uninitialized and may contain random
value, thus should not be used.
The fix checks if match_int fails, and if so, break.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/target/target_core_rd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index a6e8106abd6f..3138123143e8 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -573,7 +573,8 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
 		token = match_token(ptr, tokens, args);
 		switch (token) {
 		case Opt_rd_pages:
-			match_int(args, &arg);
+			if (match_int(args, &arg))
+				break;
 			rd_dev->rd_page_count = arg;
 			pr_debug("RAMDISK: Referencing Page"
 				" Count: %u\n", rd_dev->rd_page_count);
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-19 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26  6:48 [PATCH] target: fix a missing check for match_int Kangjie Lu
2019-01-11 20:06 ` Mike Christie
2019-01-12  5:31   ` [PATCH v2] target: fix a missing check of match_int Kangjie Lu
2019-01-19 19:06     ` Mike Christie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).