Explorar el Código

Merge "qcacmn: Fix field-spanning kernel warning during driver load" into wlan-cmn.driver.lnx.2.0.14

CNSS_WLAN Service hace 1 año
padre
commit
a6fa17f7b9
Se han modificado 1 ficheros con 4 adiciones y 8 borrados
  1. 4 8
      utils/ptt/src/wlan_ptt_sock_svc.c

+ 4 - 8
utils/ptt/src/wlan_ptt_sock_svc.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -126,7 +126,6 @@ int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid)
 	struct nlmsghdr *nlh;
 	int wmsg_length = be16_to_cpu(wmsg->length);
 	static int nlmsg_seq;
-	void *out;
 
 	if (radio < 0 || radio > ANI_MAX_RADIOS) {
 		PTT_TRACE(QDF_TRACE_LEVEL_ERROR, "%s: invalid radio id [%d]\n",
@@ -154,12 +153,9 @@ int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid)
 	}
 	wnl = (tAniNlHdr *) nlh;
 	wnl->radio = radio;
-	/* kernel FORTIFY_SOURCE may warn when multiple struct are copied
-	 * using memcpy. So, to avoid, assign a void pointer to the struct
-	 * and copy using memcpy
-	 */
-	out = &wnl->wmsg;
-	memcpy(out, wmsg, wmsg_length);
+
+	/* Offset of data buffer from nlmsg_hdr + sizeof(int) radio */
+	memcpy(nlmsg_data(nlh) + sizeof(wnl->radio), wmsg, wmsg_length);
 #ifdef PTT_SOCK_DEBUG_VERBOSE
 	ptt_sock_dump_buf((const unsigned char *)skb->data, skb->len);
 #endif