* [PATCH] staging: gpib: ni_usb: Move kfree after last use of in_data
@ 2024-10-15 20:45 Kees Bakker
2024-10-19 8:00 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Kees Bakker @ 2024-10-15 20:45 UTC (permalink / raw)
To: Dave Penkler, Linux Staging
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;
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] staging: gpib: ni_usb: Move kfree after last use of in_data
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
2024-10-19 18:30 ` Kees Bakker
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2024-10-19 8:00 UTC (permalink / raw)
To: Kees Bakker; +Cc: Dave Penkler, Linux Staging
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] staging: gpib: ni_usb: Move kfree after last use of in_data
2024-10-19 8:00 ` Greg KH
@ 2024-10-19 18:30 ` Kees Bakker
0 siblings, 0 replies; 3+ messages in thread
From: Kees Bakker @ 2024-10-19 18:30 UTC (permalink / raw)
To: Greg KH; +Cc: Dave Penkler, Linux Staging
Op 19-10-2024 om 10:00 schreef Greg KH:
> 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?
It was already done in commit b0a7dfeb7df ("staging: gpib: Move free
after the variable use has been completed")
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-19 18:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-10-19 18:30 ` Kees Bakker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox