From: Jiri Kosina <jkosina@suse.cz>
To: linux-input@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH 14/14] HID: check for NULL field when setting values
Date: Wed, 28 Aug 2013 22:32:49 +0200 (CEST) [thread overview]
Message-ID: <alpine.LNX.2.00.1308282232080.22181@pobox.suse.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.1308282223090.22181@pobox.suse.cz>
On Wed, 28 Aug 2013, Jiri Kosina wrote:
> From: Kees Cook <keescook@chromium.org>
>
> Defensively check that the field to be worked on is not NULL.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: stable@kernel.org
> ---
> drivers/hid/hid-core.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 55798b2..192be6b 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1206,7 +1206,12 @@ EXPORT_SYMBOL_GPL(hid_output_report);
>
> int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
> {
> - unsigned size = field->report_size;
> + unsigned size;
> +
> + if (!field)
> + return -1;
> +
> + size = field->report_size;
Kees,
do you actually see any way how field could ever be null in
hid_set_field()?
--
Jiri Kosina
SUSE Labs
next prev parent reply other threads:[~2013-08-28 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-28 20:32 [PATCH 14/14] HID: check for NULL field when setting values Jiri Kosina
2013-08-28 20:32 ` Jiri Kosina [this message]
2013-08-28 21:14 ` Kees Cook
2013-09-04 10:05 ` Jiri Kosina
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=alpine.LNX.2.00.1308282232080.22181@pobox.suse.cz \
--to=jkosina@suse.cz \
--cc=keescook@chromium.org \
--cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox