Commit afa9a6f4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull staging driver fix from Greg KH:
 "Here is a single staging driver fix for 6.16-rc4. It resolves a build
  error in the rtl8723bs driver for some versions of clang on arm64 when
  checking the frame size with -Wframe-larger-than.

  It has been in linux-next for a while now with no reported issues"

* tag 'staging-6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher()
parents 798804b6 a55bc4ff
Loading
Loading
Loading
Loading
+14 −30
Original line number Diff line number Diff line
@@ -868,29 +868,21 @@ static signed int aes_cipher(u8 *key, uint hdrlen,
		num_blocks, payload_index;

	u8 pn_vector[6];
	u8 mic_iv[16];
	u8 mic_header1[16];
	u8 mic_header2[16];
	u8 ctr_preload[16];
	u8 mic_iv[16] = {};
	u8 mic_header1[16] = {};
	u8 mic_header2[16] = {};
	u8 ctr_preload[16] = {};

	/* Intermediate Buffers */
	u8 chain_buffer[16];
	u8 aes_out[16];
	u8 padded_buffer[16];
	u8 chain_buffer[16] = {};
	u8 aes_out[16] = {};
	u8 padded_buffer[16] = {};
	u8 mic[8];
	uint	frtype  = GetFrameType(pframe);
	uint	frsubtype  = GetFrameSubType(pframe);

	frsubtype = frsubtype>>4;

	memset((void *)mic_iv, 0, 16);
	memset((void *)mic_header1, 0, 16);
	memset((void *)mic_header2, 0, 16);
	memset((void *)ctr_preload, 0, 16);
	memset((void *)chain_buffer, 0, 16);
	memset((void *)aes_out, 0, 16);
	memset((void *)padded_buffer, 0, 16);

	if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen ==  WLAN_HDR_A3_QOS_LEN))
		a4_exists = 0;
	else
@@ -1080,15 +1072,15 @@ static signed int aes_decipher(u8 *key, uint hdrlen,
			num_blocks, payload_index;
	signed int res = _SUCCESS;
	u8 pn_vector[6];
	u8 mic_iv[16];
	u8 mic_header1[16];
	u8 mic_header2[16];
	u8 ctr_preload[16];
	u8 mic_iv[16] = {};
	u8 mic_header1[16] = {};
	u8 mic_header2[16] = {};
	u8 ctr_preload[16] = {};

		/* Intermediate Buffers */
	u8 chain_buffer[16];
	u8 aes_out[16];
	u8 padded_buffer[16];
	u8 chain_buffer[16] = {};
	u8 aes_out[16] = {};
	u8 padded_buffer[16] = {};
	u8 mic[8];

	uint frtype  = GetFrameType(pframe);
@@ -1096,14 +1088,6 @@ static signed int aes_decipher(u8 *key, uint hdrlen,

	frsubtype = frsubtype>>4;

	memset((void *)mic_iv, 0, 16);
	memset((void *)mic_header1, 0, 16);
	memset((void *)mic_header2, 0, 16);
	memset((void *)ctr_preload, 0, 16);
	memset((void *)chain_buffer, 0, 16);
	memset((void *)aes_out, 0, 16);
	memset((void *)padded_buffer, 0, 16);

	/* start to decrypt the payload */

	num_blocks = (plen-8) / 16; /* plen including LLC, payload_length and mic) */