public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: tuhaowen <tuhaowen@uniontech.com>
Cc: alexander.deucher@amd.com, huangbibo@uniontech.com,
	linux-kernel@vger.kernel.org, sudipm.mukherjee@gmail.com,
	wangyuli@uniontech.com
Subject: Re: Re: [PATCH] dev/parport: fix the array out-of-bounds risk
Date: Fri, 5 Jul 2024 11:42:19 +0200	[thread overview]
Message-ID: <2024070523-singer-dweller-f1bb@gregkh> (raw)
In-Reply-To: <20240705085834.17224-1-tuhaowen@uniontech.com>

On Fri, Jul 05, 2024 at 04:58:34PM +0800, tuhaowen wrote:
> On Fri, Jul 05, 2024 at 02:45:45PM +0800, Greg Kroah-Hartman wrote:
> 
> > I'm not disputing that this change looks correct, I'm asking that you
> > redo it and properly check the array size when writing to it so as to
> > ensure that it really is correct in case our math is incorrect
> > somewhere.
> 
> Thank you for your feedback. I have redone the change and 
> ensured that the array size is properly checked when writing to it. 
> Please find my updated patch below.
> 
> Thanks,
> 
> Haowen.Tu
> 
> 
> >From cfdf8445987147f3a7e4f1232a8c6e8a271e4a6d Mon Sep 17 00:00:00 2001
> From: tuhaowen <tuhaowen@uniontech.com>
> Date: Mon, 27 May 2024 14:34:32 +0800
> Subject: [PATCH] dev/parport: fix the array out-of-bounds risk

Sorry, we can't take inline patches like this, please read the
documentation for how to submit a new version of a patch.

But, some comments below:

>         for (dev = port->devices; dev ; dev = dev->next) {
>                 if(dev == port->cad) {
> -                       len += sprintf(buffer, "%s\n", dev->name);
> +                       len += snprintf(buffer, 64, "%s\n", dev->name);

Don't use magic numbers here and everywhere else, use sizeof() to
compute these properly everywhere.

thanks,

greg k-h

  reply	other threads:[~2024-07-05  9:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  2:11 [PATCH] dev/parport: fix the array out-of-bounds risk tuhaowen
2024-07-04 10:07 ` Greg KH
2024-07-05  6:36   ` tuhaowen
2024-07-05  6:45     ` Greg KH
2024-07-05  8:58       ` tuhaowen
2024-07-05  9:42         ` Greg KH [this message]
2024-07-08  2:33           ` tuhaowen
2024-07-08  7:18             ` Greg KH
2024-07-08  8:04               ` [PATCH v2] " tuhaowen

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=2024070523-singer-dweller-f1bb@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=huangbibo@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=tuhaowen@uniontech.com \
    --cc=wangyuli@uniontech.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