Commit 9b00565a authored by Bitterblue Smith's avatar Bitterblue Smith Committed by Kalle Valo
Browse files

wifi: rtl8xxxu: Use strscpy instead of sprintf



Fill priv->chip_name and priv->chip_vendor with strscpy instead of
sprintf. This is just to prevent future bugs in case the name of a
chip/vendor becomes longer than the size of chip_name/chip_vendor.

Suggested-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarBitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/5fc9cc0e-eecb-8428-aeb1-f745791c0f16@gmail.com
parent 486e0315
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
	u32 sys_cfg, vendor;
	int ret = 0;

	sprintf(priv->chip_name, "8188FU");
	strscpy(priv->chip_name, "8188FU", sizeof(priv->chip_name));
	priv->rtl_chip = RTL8188F;
	priv->rf_paths = 1;
	priv->rx_paths = 1;
+4 −4
Original line number Diff line number Diff line
@@ -345,12 +345,12 @@ static int rtl8192cu_identify_chip(struct rtl8xxxu_priv *priv)
		bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
		bonding &= HPON_FSM_BONDING_MASK;
		if (bonding == HPON_FSM_BONDING_1T2R) {
			sprintf(priv->chip_name, "8191CU");
			strscpy(priv->chip_name, "8191CU", sizeof(priv->chip_name));
			priv->tx_paths = 1;
			priv->usb_interrupts = 1;
			priv->rtl_chip = RTL8191C;
		} else {
			sprintf(priv->chip_name, "8192CU");
			strscpy(priv->chip_name, "8192CU", sizeof(priv->chip_name));
			priv->tx_paths = 2;
			priv->usb_interrupts = 0;
			priv->rtl_chip = RTL8192C;
@@ -358,7 +358,7 @@ static int rtl8192cu_identify_chip(struct rtl8xxxu_priv *priv)
		priv->rf_paths = 2;
		priv->rx_paths = 2;
	} else {
		sprintf(priv->chip_name, "8188CU");
		strscpy(priv->chip_name, "8188CU", sizeof(priv->chip_name));
		priv->rf_paths = 1;
		priv->rx_paths = 1;
		priv->tx_paths = 1;
@@ -451,7 +451,7 @@ static int rtl8192cu_parse_efuse(struct rtl8xxxu_priv *priv)
	priv->power_base = &rtl8192c_power_base;

	if (efuse->rf_regulatory & 0x20) {
		sprintf(priv->chip_name, "8188RU");
		strscpy(priv->chip_name, "8188RU", sizeof(priv->chip_name));
		priv->rtl_chip = RTL8188R;
		priv->hi_pa = 1;
		priv->no_pape = 1;
+2 −2
Original line number Diff line number Diff line
@@ -496,11 +496,11 @@ static int rtl8192eu_identify_chip(struct rtl8xxxu_priv *priv)
	bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
	bonding &= HPON_FSM_BONDING_MASK;
	if (bonding == HPON_FSM_BONDING_1T2R) {
		sprintf(priv->chip_name, "8191EU");
		strscpy(priv->chip_name, "8191EU", sizeof(priv->chip_name));
		priv->tx_paths = 1;
		priv->rtl_chip = RTL8191E;
	} else {
		sprintf(priv->chip_name, "8192EU");
		strscpy(priv->chip_name, "8192EU", sizeof(priv->chip_name));
		priv->tx_paths = 2;
		priv->rtl_chip = RTL8192E;
	}
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ static int rtl8723au_identify_chip(struct rtl8xxxu_priv *priv)
		goto out;
	}

	sprintf(priv->chip_name, "8723AU");
	strscpy(priv->chip_name, "8723AU", sizeof(priv->chip_name));
	priv->usb_interrupts = 1;
	priv->rtl_chip = RTL8723A;

+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ static int rtl8723bu_identify_chip(struct rtl8xxxu_priv *priv)
		goto out;
	}

	sprintf(priv->chip_name, "8723BU");
	strscpy(priv->chip_name, "8723BU", sizeof(priv->chip_name));
	priv->rtl_chip = RTL8723B;
	priv->rf_paths = 1;
	priv->rx_paths = 1;
Loading