public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v5 1/3] staging: rtl8723bs: change return type of _rtw_pktfile_read to int
@ 2026-01-22 13:23 Minu Jin
  2026-01-22 15:31 ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Minu Jin @ 2026-01-22 13:23 UTC (permalink / raw)
  To: dan.carpenter
  Cc: gregkh, andriy.shevchenko, abrahamadekunle50, zxcv2569763104,
	milospuric856, karanja99erick, weibu, linux-staging, linux-kernel

Hi Dan,

Thanks for the feedback.
I'll drop the type-change patch and reorganize the series
into two patches for v6 as you suggested.

Regarding the return type,
I’ve audited the call sites including set_qos(), update_attrib(),
and rtw_xmitframe_coalesce(), along with their callers rtw_xmit() and xmit_frames().

Since these functions handle errors immediately and exit,
I initially thought a negative return value would be safe.

I'm curious if I missed a specific scenario in the current code,
or if your advice is more about general defensive programming—such as avoiding
future risks like implicit casting or pointer arithmetic issues.

I’d appreciate your insight on this
so I can better understand the preferred approach in the kernel.

Best regards

Minu Jin

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH v5 1/3] staging: rtl8723bs: change return type of _rtw_pktfile_read to int
@ 2026-01-22 14:23 Minu Jin
  2026-01-22 14:35 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Minu Jin @ 2026-01-22 14:23 UTC (permalink / raw)
  To: dan.carpenter
  Cc: gregkh, andriy.shevchenko, abrahamadekunle50, zxcv2569763104,
	milospuric856, karanja99erick, weibu, linux-staging, linux-kernel

Hi Dan,

Sorry, I just realized what you meant.

You were suggesting to keep the 'Fix' (including the necessary type 
change for error codes) and 'Cleanup' (formatting and style) separate 
to make the fix easier to backport.

I misunderstood "leave the type alone" as "never change the type." 
I'll reorganize the series into the two patches 
you suggested and send v6 shortly.

Thanks for the clarification!

Best regards

Minu Jin

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH v5 0/3] staging: rtl8723bs: improve error handling in _rtw_pktfile_read
@ 2026-01-22  4:14 Minu Jin
  2026-01-22  4:14 ` [PATCH v5 1/3] staging: rtl8723bs: change return type of _rtw_pktfile_read to int Minu Jin
  0 siblings, 1 reply; 6+ messages in thread
From: Minu Jin @ 2026-01-22  4:14 UTC (permalink / raw)
  To: gregkh
  Cc: andriy.shevchenko, abrahamadekunle50, zxcv2569763104,
	milospuric856, karanja99erick, weibu, dan.carpenter,
	linux-staging, linux-kernel, Minu Jin

This patch series improves the error handling and data integrity of 
_rtw_pktfile_read() by preventing unsafe partial reads and ensuring 
proper error propagation.

Previously, _rtw_pktfile_read() allowed partial reads when requested 
data was insufficient, which could lead to incomplete packet parsing 
and potential errors in callers. This series updates the function to 
only update internal pointers when a full read is successful, and 
updates all callers to handle the new error codes correctly.

I do not have the physical hardware to test this, so I have carefully 
reviewed every place where _rtw_pktfile_read() is used in this driver. 
I have also confirmed that the driver builds without any errors or 
warnings with these patches applied.

Changes since v4:
    - Split the single large patch into a 3-patch series as suggested by 
      Greg Kroah-Hartman to ensure each patch performs one logical task.

    - Patch 1: Refactor return type to 'int' and replace non-standard 'uint' 
      parameter with 'unsigned int' for better type consistency and to 
      prepare for error propagation.

    - Patch 2: Add missing error checks and update existing handlers to 
      correctly recognize negative error codes. This includes inserting 
      new checks after _rtw_pktfile_read() and updating existing 
      '== _FAIL' logic to '!= _SUCCESS' to ensure all failures are caught.

    - Patch 3: Implement the core logic to prevent partial reads and 
      return -EINVAL when data is insufficient.

-- 
2.43.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-22 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 13:23 [PATCH v5 1/3] staging: rtl8723bs: change return type of _rtw_pktfile_read to int Minu Jin
2026-01-22 15:31 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2026-01-22 14:23 Minu Jin
2026-01-22 14:35 ` Greg KH
2026-01-22  4:14 [PATCH v5 0/3] staging: rtl8723bs: improve error handling in _rtw_pktfile_read Minu Jin
2026-01-22  4:14 ` [PATCH v5 1/3] staging: rtl8723bs: change return type of _rtw_pktfile_read to int Minu Jin
2026-01-22  5:35   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox