From patchwork Wed Nov 1 21:26:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 117733 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1371331qgn; Wed, 1 Nov 2017 14:27:52 -0700 (PDT) X-Google-Smtp-Source: ABhQp+REvyw5E6X8k509A76DGula2nMsbp73YVVeDQJPIYhNEW1mqR0QDacTrBf6Ui4tkptvMUhE X-Received: by 10.98.70.78 with SMTP id t75mr1299780pfa.6.1509571672340; Wed, 01 Nov 2017 14:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509571672; cv=none; d=google.com; s=arc-20160816; b=KIB8+MH2DjpcqzjYSttC17mpKBtYcks/L/ipWUs0qJbEsGK6GKYaYaJl1EobUzhBuk 4s2wxHmf3tT0cfkn0sL5jO7TP2i4YC92IX0md0I2LpBLPQ6wHGB6PjBwzlzjJjkDEtqU gOq7ucd9k42bOvRAkwdDzfjkd/Lqzs4YhYXJXRxN+8kKIOqGsaPKjVcOQPeo2qAk/noF qN/BPjTemMVlQJzfAsDSXrNnGIWP06294cuUDaRp7p6Hx+BU1egmUe72CiMh2NMRGLn7 w0kKzbpHVFT34nFLegq/04/oY/Rjx7PwmJj0oWYimYMzMAm2ShvG4iiJsxtuFIN1j2Us X9mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=b5wuZZYt2PHocyguz5oRBpKSwGsSo0N4fNk+fhCOZn4=; b=OMgn/b8HrnaQQr5tEbcSWcyfPg7EiYs1evtbO4lJJFWxCHXfn+sNUvyMaDdrs6owL0 ctxBjSLOU//m8XgM5rK4q4rzwlxynGXfDDVmebT4psb2nTSCiC26OeMzMUEtChnrP1Bd I00lqhJjEyjWpUBZhRmKtd5H3KIWGLZfpq3Tku9MfHJRTMNn3QFI9bY8Nh5JYtw3pRWy kBRDfIyeL0vvmQ9Hsh7CHfmYaGOyZJ9l+tofo7es2HTqOFyT65c0RLfbdi8yi8awtEVn 9xj4twU9+IbcEiapjBCkNypyXNXTC8Fb3Csgua7CTz1vHyrAHjjomcA7eqQP8kaG8dAS Zscw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f88si2043079pfk.57.2017.11.01.14.27.51; Wed, 01 Nov 2017 14:27:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934092AbdKAV1u (ORCPT + 26 others); Wed, 1 Nov 2017 17:27:50 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:35281 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934051AbdKAV1p (ORCPT ); Wed, 1 Nov 2017 17:27:45 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id vA1LQl9h004971; Wed, 1 Nov 2017 22:26:47 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , Johannes Berg , Willy Tarreau Subject: [PATCH 3.10 071/139] wext: handle NULL extra data in iwe_stream_add_point better Date: Wed, 1 Nov 2017 22:26:12 +0100 Message-Id: <1509571600-4858-22-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1509571600-4858-1-git-send-email-w@1wt.eu> References: <1509571159-4405-1-git-send-email-w@1wt.eu> <1509571600-4858-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 93be2b74279c15c2844684b1a027fdc71dd5d9bf upstream. 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 0 and the memcpy doesn't actually have an effect. Making the length check explicit avoids the warning and should have no other effect here. Also check the pointer itself, since otherwise we get warnings elsewhere in the code. Signed-off-by: Arnd Bergmann Signed-off-by: Johannes Berg Signed-off-by: Willy Tarreau --- include/net/iw_handler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index 5d5a6a4..5af07a1 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h @@ -551,7 +551,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 && extra) + memcpy(stream + point_len, extra, iwe->u.data.length); stream += event_len; } return stream;