From: Mike Christie <mchristi@redhat.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] target: fix a missing check for match_int
Date: Fri, 11 Jan 2019 14:06:03 -0600 [thread overview]
Message-ID: <5C38F72B.5000203@redhat.com> (raw)
In-Reply-To: <20181226064818.75984-1-kjlu@umn.edu>
On 12/26/2018 12:48 AM, Kangjie Lu wrote:
> 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;
I think if this fails you would want to return an error.
Also, I think you want to add a similar check for the Opt_rd_nullio call
below this chunk because arg may initialized to junk.
> rd_dev->rd_page_count = arg;
> pr_debug("RAMDISK: Referencing Page"
> " Count: %u\n", rd_dev->rd_page_count);
>
WARNING: multiple messages have this Message-ID (diff)
From: Mike Christie <mchristi@redhat.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] target: fix a missing check for match_int
Date: Fri, 11 Jan 2019 20:06:03 +0000 [thread overview]
Message-ID: <5C38F72B.5000203@redhat.com> (raw)
In-Reply-To: <20181226064818.75984-1-kjlu@umn.edu>
On 12/26/2018 12:48 AM, Kangjie Lu wrote:
> 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;
I think if this fails you would want to return an error.
Also, I think you want to add a similar check for the Opt_rd_nullio call
below this chunk because arg may initialized to junk.
> rd_dev->rd_page_count = arg;
> pr_debug("RAMDISK: Referencing Page"
> " Count: %u\n", rd_dev->rd_page_count);
>
next prev parent reply other threads:[~2019-01-11 20:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-26 6:48 [PATCH] target: fix a missing check for match_int Kangjie Lu
2018-12-26 6:48 ` Kangjie Lu
2019-01-11 20:06 ` Mike Christie [this message]
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-12 5:31 ` Kangjie Lu
2019-01-19 19:06 ` Mike Christie
2019-01-19 19:06 ` Mike Christie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5C38F72B.5000203@redhat.com \
--to=mchristi@redhat.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=pakki001@umn.edu \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.