Linux kernel staging patches
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Kees Bakker <kees@ijzerbout.nl>
Cc: Dave Penkler <dpenkler@gmail.com>,
	Linux Staging <linux-staging@lists.linux.dev>
Subject: Re: [PATCH] staging: gpib: ni_usb: Move kfree after last use of in_data
Date: Sat, 19 Oct 2024 10:00:25 +0200	[thread overview]
Message-ID: <2024101925-comprised-letter-e970@gregkh> (raw)
In-Reply-To: <20241017181522.7798918DAF2@bout3.ijzerbout.nl>

On Tue, Oct 15, 2024 at 10:45:58PM +0200, Kees Bakker wrote:
> In ni_usb_read() there was a kfree before the last use of in_data.
> 
> Signed-off-by: Kees Bakker <kees@ijzerbout.nl>
> ---
>  drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
> index 1da263676f2a..75f39e1f3ed1 100644
> --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
> +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
> @@ -690,12 +690,12 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *buffer, size_t length,
>  		kfree(in_data);
>  		return parse_retval;
>  	}
> -	kfree(in_data);
>  	if (actual_length != length - status.count) {
>  		pr_err("%s: actual_length=%i expected=%li\n",
>  		       __func__, actual_length, (long)(length - status.count));
>  		ni_usb_dump_raw_block(in_data, usb_bytes_read);
>  	}
> +	kfree(in_data);
>  	switch (status.error_code) {
>  	case NIUSB_NO_ERROR:
>  		retval = 0;

Does not apply to my tree, what branch did you make this against?

thanks,

greg k-h

  reply	other threads:[~2024-10-19  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 20:45 [PATCH] staging: gpib: ni_usb: Move kfree after last use of in_data Kees Bakker
2024-10-19  8:00 ` Greg KH [this message]
2024-10-19 18:30   ` Kees Bakker

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=2024101925-comprised-letter-e970@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dpenkler@gmail.com \
    --cc=kees@ijzerbout.nl \
    --cc=linux-staging@lists.linux.dev \
    /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