From: Chanwoo Choi <cw00.choi@samsung.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
chanwoo@kernel.org, MyungJoo Ham <myungjoo.ham@samsung.com>
Subject: Re: [PATCH 1/2] extcon: Use BIT() macro for the left-shift operation
Date: Thu, 30 Mar 2017 18:15:34 +0900 [thread overview]
Message-ID: <58DCCCB6.2030206@samsung.com> (raw)
In-Reply-To: <CAHp75VcanOiXazx+VTuKN9GSLXotfVopmjviBfCJxnhuMtsURQ@mail.gmail.com>
On 2017년 03월 30일 17:59, Andy Shevchenko wrote:
> On Thu, Mar 30, 2017 at 11:39 AM, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>> This patch just uses the BIT() macro to make the code simple.
>
>> for (i = 0; i < edev->max_supported; i++) {
>> count += sprintf(buf + count, "%s=%d\n",
>> extcon_info[edev->supported_cable[i]].name,
>> - !!(edev->state & (1 << i)));
>> + !!(edev->state & BIT(i)));
>> }
>
> While change is okay, the above code is fragile. There is a potential
> buffer overflow.
When extcon device is registered, extcon_dev_register() check a number of
supported external connectors. The maximum number of supported connectors
is 32. There is no buffer overflow.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
next prev parent reply other threads:[~2017-03-30 9:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170330083943epcas1p4ccc3a12576a7232162a682b73eaeea0b@epcas1p4.samsung.com>
2017-03-30 8:39 ` [PATCH 1/2] extcon: Use BIT() macro for the left-shift operation Chanwoo Choi
2017-03-30 8:39 ` [PATCH 2/2] extcon: Add new extcon_register_notifier_all() to monitor all external connectors Chanwoo Choi
2017-03-30 9:04 ` Hans de Goede
2017-03-30 9:20 ` Chanwoo Choi
2017-03-30 14:58 ` Hans de Goede
2017-04-03 7:24 ` Chanwoo Choi
2017-04-03 11:14 ` Hans de Goede
2017-04-04 4:53 ` Chanwoo Choi
2017-04-04 10:47 ` Hans de Goede
2017-04-04 10:52 ` Chanwoo Choi
2017-03-30 9:05 ` Andy Shevchenko
2017-03-30 9:24 ` Chanwoo Choi
2017-03-30 10:42 ` Andy Shevchenko
2017-03-30 10:56 ` Chanwoo Choi
2017-03-30 11:09 ` Andy Shevchenko
2017-03-30 8:59 ` [PATCH 1/2] extcon: Use BIT() macro for the left-shift operation Andy Shevchenko
2017-03-30 9:15 ` Chanwoo Choi [this message]
2017-03-30 10:38 ` Andy Shevchenko
2017-03-30 10:52 ` Chanwoo Choi
2017-03-30 11:12 ` Andy Shevchenko
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=58DCCCB6.2030206@samsung.com \
--to=cw00.choi@samsung.com \
--cc=andy.shevchenko@gmail.com \
--cc=chanwoo@kernel.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/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;
as well as URLs for NNTP newsgroup(s).