mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xia Fukun <xiafukun@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <prajnoha@redhat.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kobject: Fix global-out-of-bounds in kobject_action_type()
Date: Tue, 7 Mar 2023 17:49:25 +0800	[thread overview]
Message-ID: <50e3be73-5fb1-0505-6ddb-422cee6e466b@huawei.com> (raw)
In-Reply-To: <ZAcDlAkujTLkbrqr@kroah.com>

I know how to modify it to meet your requirements:

	for (action = 0; action < ARRAY_SIZE(kobject_actions); action++) {
		if (strncmp(kobject_actions[action], buf, count_first) != 0)
			continue;
		if (strlen(kobject_actions[action]) > count_first)
			continue;
		if (args)
			*args = args_start;
		*type = action;
		ret = 0;
		break;
	}

So I will modify the patch and resubmit it. Please review it again

在 2023/3/7 17:27, Greg KH 写道:

> 
> On Tue, Mar 07, 2023 at 05:08:02PM +0800, Xia Fukun wrote:
>> Thanks for your reply.
>> Your understanding is correct."offline\0\0\0\0\0\0\0\0\0\0" is indeed blocked
>> from matching "offline" and returns a failed result.
>>
>> I'm not sure whether to relax the restrictions to make it match successfully.
>> After all, the incoming count is too large and not the actual length of
>> "offline".
> 
> But that doesn't matter at all.  Sometimes you do not have control over
> the buffer length when writing to a file like this, what matters is the
> content of the buffer and we should stop at the first \0 as that's the
> "end of a string" in this type of api.
> 
> So your change here might break existing userspace code, and we can't do
> that, sorry.
> 
> thanks,
> 
> greg k-h

  reply	other threads:[~2023-03-07  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  6:37 Xia Fukun
2023-03-07  8:16 ` Greg KH
2023-03-07  9:08   ` Xia Fukun
2023-03-07  9:27     ` Greg KH
2023-03-07  9:49       ` Xia Fukun [this message]
2023-03-07  9:58         ` Greg KH

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=50e3be73-5fb1-0505-6ddb-422cee6e466b@huawei.com \
    --to=xiafukun@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prajnoha@redhat.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

all inboxes | Powered by JetHome®