[PATCH v3 0/2] staging: rtl8723bs: refactor rtw_aes_decrypt()

Lin YuChen posted 2 patches 2 weeks, 3 days ago
drivers/staging/rtl8723bs/core/rtw_security.c | 86 +++++++++----------
1 file changed, 42 insertions(+), 44 deletions(-)
[PATCH v3 0/2] staging: rtl8723bs: refactor rtw_aes_decrypt()
Posted by Lin YuChen 2 weeks, 3 days ago
This series refactors rtw_aes_decrypt() to improve code readability by
reducing nesting levels through the use of guard clauses.

Changes in v3:
 - Follow Dan Carpenter's suggestion to use direct returns (e.g., return
   _SUCCESS or _FAIL) instead of "goto exit" for the newly introduced
   guard clauses.
 - Revert unrelated line-breaking and formatting changes to ensure the
   patch remains focused strictly on the refactoring of indentation
   levels, as advised by Dan.
 - Keep the two-step patch series structure requested by Greg KH.

Changes in v2:
 - Split the refactor into a two-patch series to make logic verification
   easier, as requested by Greg KH.

Lin YuChen (2):
  staging: rtl8723bs: use guard clause for AES check
  staging: rtl8723bs: use guard clause for stainfo check

 drivers/staging/rtl8723bs/core/rtw_security.c | 86 +++++++++----------
 1 file changed, 42 insertions(+), 44 deletions(-)

-- 
2.34.1
Re: [PATCH v3 0/2] staging: rtl8723bs: refactor rtw_aes_decrypt()
Posted by Dan Carpenter 2 weeks, 3 days ago
On Thu, Mar 19, 2026 at 08:07:35PM +0800, Lin YuChen wrote:
> This series refactors rtw_aes_decrypt() to improve code readability by
> reducing nesting levels through the use of guard clauses.
> 
> Changes in v3:
>  - Follow Dan Carpenter's suggestion to use direct returns (e.g., return
>    _SUCCESS or _FAIL) instead of "goto exit" for the newly introduced
>    guard clauses.
>  - Revert unrelated line-breaking and formatting changes to ensure the
>    patch remains focused strictly on the refactoring of indentation
>    levels, as advised by Dan.

Thanks.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

You don't have to do this if you don't want, but unrelated to your
patch but the last two bytes of &le_tmp64 in rtw_BIP_verify() should
be initialized.  Just set it to zero at the start of the function.
Otherwise it's an uninitialized variable.

drivers/staging/rtl8723bs/core/rtw_security.c:1308 rtw_BIP_verify() warn: not copying enough bytes for '&le_tmp64' (8 vs 6 bytes)

regards,
dan carpenter
Re: [PATCH v3 0/2] staging: rtl8723bs: refactor rtw_aes_decrypt()
Posted by YuChen Lin 2 weeks, 3 days ago
On Thu, Mar 19, 2026 at 8:46 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
>
> Thanks.
>
> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

Thanks for the Reviewed-by!

> You don't have to do this if you don't want, but unrelated to your
> patch but the last two bytes of &le_tmp64 in rtw_BIP_verify() should
> be initialized.  Just set it to zero at the start of the function.
> Otherwise it's an uninitialized variable.
>
> drivers/staging/rtl8723bs/core/rtw_security.c:1308 rtw_BIP_verify() warn: not copying enough bytes for '&le_tmp64' (8 vs 6 bytes)
>
> regards,
> dan carpenter

I will send a separate patch to initialize le_tmp64 in
rtw_BIP_verify() as you suggested.

Regards,
Lin YuChen