From patchwork Wed Jan 11 14:35:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9510171 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64423601E7 for ; Wed, 11 Jan 2017 14:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 599AF28501 for ; Wed, 11 Jan 2017 14:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E70428655; Wed, 11 Jan 2017 14:36:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFF2828501 for ; Wed, 11 Jan 2017 14:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755728AbdAKOfu (ORCPT ); Wed, 11 Jan 2017 09:35:50 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:52747 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752041AbdAKOfs (ORCPT ); Wed, 11 Jan 2017 09:35:48 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MQaxF-1c2HI502E1-00U4rN; Wed, 11 Jan 2017 15:35:36 +0100 From: Arnd Bergmann To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Arnd Bergmann , "David S. Miller" , Johannes Berg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] wext: handle NULL exta data in iwe_stream_add_point better Date: Wed, 11 Jan 2017 15:35:25 +0100 Message-Id: <20170111143532.485827-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:c10F6vngrdpqchzdCxSdkPiEiteFP2FRgYC4jlFQ4hX/mjUpyzZ ZR5d5GW8uunYRn4AleNvrjiQFez207ziF2nb0czC+lev0NZ6RltQvk3enzbVoRWPxHTI9H2 pl+r5M4yTyucTCnCfAUxzOW1G+mSiuNCHe5ISLhYUtx1tNldqIJEHYciw9pl5AeZZ4JMBPp JoxNwBbgeCG9+HhhZpBhg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Qo2b+Avbvw4=:GEc8RJzN3sseR8inAS1RST rikV99D+NiimNUAwA+UiiHgc5C/Rct9i9nEQHaEhNymr4s8yyTv21ULSQSB67zCEQVTkiMb/n JKdazIAGwB9v8PTNhN0qJBJdvKpFsLh16JO2rSiAP3uMY8vJUvQFEFA9XxulL5+pSZyB5w7HI XYinXm8w/RxoRiaarJztKQQtQK+g9CrnbA21LNxygYJLFzaDyWoymZjF0XJzUXSK3hrwiKxHG gV0rQUky67n1FCACG5hLTonRiYFMoy1BtYcd6hJzNlCnEGTZ8brbNLQtOOQM0HrTDYM7I9sTd yty7u9jXRntPVXf6fQHWyRoORmcQeyRxCc0WB92TIabv9ZPz52J47Q7rsjkPv3Q1fidfa/caH uzaFhowcT+4DXZ/uYuc6jDeed1EfWfNO1lJ54TI0xtHa6znWyyWbu4j3iq4x62M+FPFPt4cFX d6APocSpdJL3qLYaQsnWfCFyt9Sw5ANsgO0PpKqxFyUw6LKBDU+U+9hinA7MEMBAr3pYn//Bw ZlApMHpiFuPhxhCSw2im3eJUs7cS58EJH8SEZUIj6jO7FlagRsplsXbivMWVBlOqb9l8L2Ret SKo/utWkngXkPMjcv6yBLoeHL8z0uR8B0JzWoB/b3davdOO+UZCZaQIcAdvUWJiuhTsEPtQ31 MKWIknqbfjsuRBbh/PoUhXgA3Ia+CEwCSFJxDrzBp4/7jSUBjLXhUOF2pAMzAqv/jQQo= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gcc-7 complains that wl3501_cs passes NULL into a function that then uses the argument as the input for memcpy: drivers/net/wireless/wl3501_cs.c: In function 'wl3501_get_scan': include/net/iw_handler.h:559:3: error: argument 2 null where non-null expected [-Werror=nonnull] memcpy(stream + point_len, extra, iwe->u.data.length); This works fine here because iwe->u.data.length is guaranteed to be NULL, and the memcpy doesn't actually have an effect. Making the length check explicit avoids the warning and should have no other effect here. Signed-off-by: Arnd Bergmann --- include/net/iw_handler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index e0f4109e64c6..1a41043688bc 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h @@ -556,7 +556,8 @@ iwe_stream_add_point(struct iw_request_info *info, char *stream, char *ends, memcpy(stream + lcp_len, ((char *) &iwe->u) + IW_EV_POINT_OFF, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN); - memcpy(stream + point_len, extra, iwe->u.data.length); + if (iwe->u.data.length) + memcpy(stream + point_len, extra, iwe->u.data.length); stream += event_len; } return stream;