mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pranav Desai <contact.pranavdesai@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Pranav Desai <contact.pranavdesai@gmail.com>
Subject: [PATCH v3 4/6] staging: rtl8723bs: use explicit types for math variables and iterators
Date: Wed,  7 Oct 2026 17:23:40 +0530	[thread overview]
Message-ID: <20261007115342.1121742-5-contact.pranavdesai@gmail.com> (raw)
In-Reply-To: <20261007115342.1121742-1-contact.pranavdesai@gmail.com>

Replace 'uint' with explicit types for variables used in math operations
and loops inside the aes_cipher() and aes_decipher() functions:

- Change 'payload_remainder' to u8 because it is calculated as (plen % 16),
which guarantees a range of 0-15.
- Change 'payload_index' to u32 because it indexes into the payload, which
is bounded by plen (u32).
- Change 'num_blocks' to u32 since it is derived from 'plen' (u32).
- Change loop iterators (i, j) to standard 'unsigned int'.

Signed-off-by: Pranav Desai <contact.pranavdesai@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_security.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 676587fabfe4..ff8af1a29b22 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -784,8 +784,10 @@ static signed int aes_cipher(u8 *key, u16 hdrlen,
 			     u8 *pframe, u32 plen)
 {
 	bool qc_exists, a4_exists;
-	uint	i, j, payload_remainder,
-		num_blocks, payload_index;
+	u8 payload_remainder;
+	u32 payload_index;
+	u32 num_blocks;
+	unsigned int i, j;
 
 	u8 pn_vector[6];
 	u8 mic_iv[16] = {};
@@ -986,8 +988,10 @@ static signed int aes_decipher(u8 *key, u8 hdrlen,
 {
 	static u8 message[MAX_MSG_SIZE];
 	bool qc_exists, a4_exists;
-	uint i, j, payload_remainder,
-			num_blocks, payload_index;
+	u8 payload_remainder;
+	u32 payload_index;
+	u32 num_blocks;
+	unsigned int i, j;
 	signed int res = _SUCCESS;
 	u8 pn_vector[6];
 	u8 mic_iv[16] = {};
-- 
2.55.0


  parent reply	other threads:[~2026-10-07 11:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 11:53 [PATCH v3 0/6] staging: rtl8723bs: explicitly type variables in rtw_security.c Pranav Desai
2026-10-07 11:53 ` [PATCH v3 1/6] staging: rtl8723bs: use explicit types for lengths " Pranav Desai
2026-10-07 11:53 ` [PATCH v3 2/6] staging: rtl8723bs: use bool for flags " Pranav Desai
2026-10-07 11:53 ` [PATCH v3 3/6] staging: rtl8723bs: use u8 for frame types " Pranav Desai
2026-10-07 11:53 ` Pranav Desai [this message]
2026-10-07 11:53 ` [PATCH v3 5/6] staging: rtl8723bs: use u32 for payload_length " Pranav Desai
2026-10-07 11:53 ` [PATCH v3 6/6] staging: rtl8723bs: use u32 for length variables in rtw_BIP_verify() Pranav Desai

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=20261007115342.1121742-5-contact.pranavdesai@gmail.com \
    --to=contact.pranavdesai@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®