All of lore.kernel.org
 help / color / mirror / Atom feed
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 19:52:43 +0900	[thread overview]
Message-ID: <58DCE37B.4090308@samsung.com> (raw)
In-Reply-To: <CAHp75VeSDFOq18e3NSaHBN-aNvrR5Uj56=AbFrMSAxNkaOT3LA@mail.gmail.com>

On 2017년 03월 30일 19:38, Andy Shevchenko wrote:
> On Thu, Mar 30, 2017 at 12:15 PM, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>> 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.
> 
> Is there any limit for name? No, there is not (const char *name).
> Though for now it is quite unlikely to have the issue.

If there is problem, I want to fix it. 
I hope your more comment because I don't understand what you point out.
Did you mention the length of connector name? or buf?

> 
> Feel free to proceed despite my comment.
> 

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

  reply	other threads:[~2017-03-30 10:52 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
     [not found]   ` <CGME20170330083943epcas1p4c5559cab13ef732b6bf149f810aa2f46@epcas1p4.samsung.com>
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
2017-03-30 10:38       ` Andy Shevchenko
2017-03-30 10:52         ` Chanwoo Choi [this message]
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=58DCE37B.4090308@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 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.