All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khalid Aziz <khalid@gonehiking.org>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] scsi: BusLogic: Avoid unbounded `vsprintf' use
Date: Thu, 22 Apr 2021 11:30:10 -0600	[thread overview]
Message-ID: <55356910-b46e-cfab-bb67-fc364ebf5740@gonehiking.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2104201939390.44318@angie.orcam.me.uk>

On 4/20/21 12:01 PM, Maciej W. Rozycki wrote:
> Existing `blogic_msg' invocations do not appear to overrun its internal 
> buffer of a fixed length of 100, which would cause stack corruption, but 
> it's easy to miss with possible further updates and a fix is cheap in 
> performance terms, so limit the output produced into the buffer by using 
> `vscnprintf' rather than `vsprintf'.
> 
> Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
> ---
> Changes from v1:
> 
> - use `vscnprintf' instead of `vsnprintf' for the correct character count.
> ---
>  drivers/scsi/BusLogic.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> linux-buslogic-vscnprintf.diff
> Index: linux-macro-ide/drivers/scsi/BusLogic.c
> ===================================================================
> --- linux-macro-ide.orig/drivers/scsi/BusLogic.c
> +++ linux-macro-ide/drivers/scsi/BusLogic.c
> @@ -3588,7 +3588,7 @@ static void blogic_msg(enum blogic_msgle
>  	int len = 0;
>  
>  	va_start(args, adapter);
> -	len = vsprintf(buf, fmt, args);
> +	len = vscnprintf(buf, sizeof(buf), fmt, args);
>  	va_end(args);
>  	if (msglevel == BLOGIC_ANNOUNCE_LEVEL) {
>  		static int msglines = 0;
> 

Acked-by: Khalid Aziz <khalid@gonehiking.org>

  reply	other threads:[~2021-04-22 17:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 18:01 [PATCH v2 0/5] Bring the BusLogic host bus adapter driver up to Y2021 Maciej W. Rozycki
2021-04-20 18:01 ` [PATCH v2 1/5] scsi: BusLogic: Fix missing `pr_cont' use Maciej W. Rozycki
2021-04-21  8:13   ` David Laight
2021-04-21 12:28     ` Maciej W. Rozycki
2021-04-22 17:26   ` Khalid Aziz
2021-04-20 18:01 ` [PATCH v2 2/5] scsi: BusLogic: Avoid unbounded `vsprintf' use Maciej W. Rozycki
2021-04-22 17:30   ` Khalid Aziz [this message]
2021-04-20 18:01 ` [PATCH v2 3/5] scsi: Provide for avoiding trailing allocation length with VPD inquiries Maciej W. Rozycki
2021-04-20 18:02 ` [PATCH v2 4/5] scsi: Avoid using reserved length byte " Maciej W. Rozycki
2021-04-20 18:02 ` [PATCH v2 5/5] scsi: Set allocation length to 255 for ATA Information VPD page Maciej W. Rozycki
2021-06-10 23:25 ` [PING][PATCH v2 0/5] Bring the BusLogic host bus adapter driver up to Y2021 Maciej W. Rozycki
2021-06-11  0:53   ` Martin K. Petersen
2021-06-30 10:36     ` Maciej W. Rozycki
2021-07-08  3:33       ` Martin K. Petersen
2021-06-13 23:14   ` Nix

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=55356910-b46e-cfab-bb67-fc364ebf5740@gonehiking.org \
    --to=khalid@gonehiking.org \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=martin.petersen@oracle.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.