qcacmn: Fix field-spanning kernel warning during driver load
Currently in driver, we use memcpy() to copy data stored in log buffers to multiple fields in the struct tAniHdr. But from kernel 6.1, if FORTIFY_SOURCE feature is enabled, then kernel warns of field-spanning. To resolve this issue, assign a void pointer to the struct and use it in memcpy(). Change-Id: If4d089f4118c573ef57b87b83f9a350da1674b2b CRs-Fixed: 3465600
这个提交包含在:
@@ -679,6 +679,7 @@ static int send_filled_buffers_to_user(void)
|
||||
static int nlmsg_seq;
|
||||
unsigned long flags;
|
||||
static int rate_limit;
|
||||
void *out;
|
||||
|
||||
while (!list_empty(&gwlan_logging.filled_list)
|
||||
&& !gwlan_logging.exit) {
|
||||
@@ -725,7 +726,12 @@ static int send_filled_buffers_to_user(void)
|
||||
|
||||
wnl = (tAniNlHdr *) nlh;
|
||||
wnl->radio = plog_msg->radio;
|
||||
memcpy(&wnl->wmsg, plog_msg->logbuf,
|
||||
/* 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, plog_msg->logbuf,
|
||||
plog_msg->filled_length + sizeof(tAniHdr));
|
||||
|
||||
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
|
||||
|
在新工单中引用
屏蔽一个用户