Re: [PATCH] kobject: Fix global-out-of-bounds in kobject_action_type()

From: Greg KH
Date: Tue Mar 07 2023 - 04:58:35 EST


On Tue, Mar 07, 2023 at 05:49:25PM +0800, Xia Fukun wrote:
> I know how to modify it to meet your requirements:

Again, please stop top-posting, as I can't follow what you are trying to
do here at all otherwise.

>
> 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

Please test your change and submit it and then I will add it to my
review queue like everything else I get :)

But again, this whole function feels very fragile, shouldn't it be
rewritten to be more clear?

thanks,

greg k-h