public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Li Zhong <floridsleeves@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	rafael@kernel.org
Subject: Re: [PATCH v1] drivers/base/auxiliary: check return value of strrchr()
Date: Sat, 3 Sep 2022 08:33:50 +0200	[thread overview]
Message-ID: <YxL1TprLv3wzr08u@kroah.com> (raw)
In-Reply-To: <CAMEuxRrg0nSroVGXwaCM1579Ddb822mY0hkSX5_Kcz1YqF_9sg@mail.gmail.com>

On Fri, Sep 02, 2022 at 11:25:31PM -0700, Li Zhong wrote:
> From: Li Zhong <floridsleeves@gmail.com>
> 
> The return value of strrchr() could be NULL, which will cause invalid
> offset in (int)(p - name). So we check it here.
> 
> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
>  drivers/base/auxiliary.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> index 8c5e65930617..7ac23be47e1f 100644
> --- a/drivers/base/auxiliary.c
> +++ b/drivers/base/auxiliary.c
> @@ -191,7 +191,8 @@ static int auxiliary_uevent(struct device *dev,
> struct kobj_uevent_env *env)
> 
>   name = dev_name(dev);
>   p = strrchr(name, '.');
> -
> + if (!p)
> + return -EINVAL;
>   return add_uevent_var(env, "MODALIAS=%s%.*s", AUXILIARY_MODULE_PREFIX,
>         (int)(p - name), name);
>  }
> -- 
> 2.25.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch is malformed (tabs converted to spaces, linewrapped, etc.)
  and can not be applied.  Please read the file,
  Documentation/email-clients.txt in order to fix this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

  reply	other threads:[~2022-09-03  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03  6:25 [PATCH v1] drivers/base/auxiliary: check return value of strrchr() Li Zhong
2022-09-03  6:33 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-28 20:40 Li Zhong
2022-09-01 15:05 ` 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=YxL1TprLv3wzr08u@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=floridsleeves@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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