From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756163AbdKGB0u (ORCPT ); Mon, 6 Nov 2017 20:26:50 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51568 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752666AbdKFXXd (ORCPT ); Mon, 6 Nov 2017 18:23:33 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "A Raghavendra Rao" , "Greg Kroah-Hartman" , "A Raghavendra Rao" Date: Mon, 06 Nov 2017 23:03:07 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 146/147] Staging: wlan-ng: fix sparse warning in prism2fw.c In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.95-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: A Raghavendra Rao commit 41cb65c4854e14f12b1cbb8215e509d8ad4d0c88 upstream. Fix the following sparse warning : In file included from drivers/staging/wlan-ng/prism2usb.c:5:0: drivers/staging/wlan-ng/prism2fw.c: In function ‘read_cardpda.constprop.43’: drivers/staging/wlan-ng/prism2fw.c:792:1: warning: the frame size of 1068 bytes is larger than 1024 bytes [-Wframe-larger-than=] The variable to 'struct p80211msg_p2req_readpda' was previously being created on the stack, which inturn exeeded the frame size limit, resulting in a sparse warning. This patch alloctes the memory to the structure dynamically and the operations are left unchanged. Signed-off-by: A Raghavendra Rao Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/staging/wlan-ng/prism2fw.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -765,30 +765,35 @@ int plugimage(struct imgchunk *fchunk, u int read_cardpda(struct pda *pda, wlandevice_t *wlandev) { int result = 0; - struct p80211msg_p2req_readpda msg; + struct p80211msg_p2req_readpda *msg; + + msg = kzalloc(sizeof(*msg), GFP_KERNEL); + if (!msg) + return -ENOMEM; /* set up the msg */ - msg.msgcode = DIDmsg_p2req_readpda; - msg.msglen = sizeof(msg); - strcpy(msg.devname, wlandev->name); - msg.pda.did = DIDmsg_p2req_readpda_pda; - msg.pda.len = HFA384x_PDA_LEN_MAX; - msg.pda.status = P80211ENUM_msgitem_status_no_value; - msg.resultcode.did = DIDmsg_p2req_readpda_resultcode; - msg.resultcode.len = sizeof(u32); - msg.resultcode.status = P80211ENUM_msgitem_status_no_value; + msg->msgcode = DIDmsg_p2req_readpda; + msg->msglen = sizeof(msg); + strcpy(msg->devname, wlandev->name); + msg->pda.did = DIDmsg_p2req_readpda_pda; + msg->pda.len = HFA384x_PDA_LEN_MAX; + msg->pda.status = P80211ENUM_msgitem_status_no_value; + msg->resultcode.did = DIDmsg_p2req_readpda_resultcode; + msg->resultcode.len = sizeof(u32); + msg->resultcode.status = P80211ENUM_msgitem_status_no_value; - if (prism2mgmt_readpda(wlandev, &msg) != 0) { + if (prism2mgmt_readpda(wlandev, msg) != 0) { /* prism2mgmt_readpda prints an errno if appropriate */ result = -1; - } else if (msg.resultcode.data == P80211ENUM_resultcode_success) { - memcpy(pda->buf, msg.pda.data, HFA384x_PDA_LEN_MAX); + } else if (msg->resultcode.data == P80211ENUM_resultcode_success) { + memcpy(pda->buf, msg->pda.data, HFA384x_PDA_LEN_MAX); result = mkpdrlist(pda); } else { /* resultcode must've been something other than success */ result = -1; } + kfree(msg); return result; }