Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2752314imm; Sun, 17 Jun 2018 03:35:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIlfNJSjGgAH4gIIqi9ump5fH90VwQBA74m4ugLBV8xhJH6XD7/84luMw6c+crEUKU/Mtq1 X-Received: by 2002:a17:902:b611:: with SMTP id b17-v6mr9476527pls.284.1529231700407; Sun, 17 Jun 2018 03:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529231700; cv=none; d=google.com; s=arc-20160816; b=MNbUuMWELtLh1zaGsrAvsNNVhsyXMdOiqRez+ejzgpluPXqCQGYNLrQluvlrIPiHtE o4im7YwBpEvubbFHZIWloALoAI31rslU/d6Eh4g/tm22OETJR0CmjP58iHiQ9592I/6C JF1Xr3moz5BWLTw1qUAgX97h2n3StQqziGobLOTpWBcS6YXJJqXPa37sLHUDJQviGGJD rlNOUjQYiPKZbhRaVL2eZgRp8sFiBrTbNc0WONN/0zH4ZG/gfVaf5nI8A1nQn5ME3Uew aHOtBHEbgll274M0jSWAepxWKGhkkavxbMERMYRaPkAKdCqn3bDTqTN67OZ+HIl2o3hL Rh/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=TKu9k3pkXk/ER6SiHJYzujn4jQk3e1WECqrw3PwNOsM=; b=HWaAkbdNr0uVVs1+Gl9PkHO+zC+9GltENTe6bSjhcjAsFX/Bwsf4qA4hhQDZpjwx+t dILFnb991/RnI/2Sjd3qFzriGuPW7J1Yydvyw5Zq7jvhwQ9Rw7Hz/jcQq6d0wc9N3i9h VFXgf9Gr8xaOJbSbhQSAOJekgCPqMLvx9p9sAJurhNqJ6z3DXkI8N+umVs5oM0PB3oxq XReQKg3DitM/ct/t7m05oqWaEOvX4yX5ZBa8MHm3ML8ACBO3MZUU9BLTDC1qWt+fmrre YHTT4fG3ji2a7Igi5Nv9smfLEFwSkumQbxUdbpp5wiUzfPhkEqlB4ssU3T0WYne4fb1p ZByA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b="v3Pfky/w"; 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 r12-v6si12193963pfe.9.2018.06.17.03.34.45; Sun, 17 Jun 2018 03:35:00 -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; dkim=pass header.i=@agner.ch header.s=dkim header.b="v3Pfky/w"; 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 S1754321AbeFQKeV (ORCPT + 99 others); Sun, 17 Jun 2018 06:34:21 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:44294 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753976AbeFQKeT (ORCPT ); Sun, 17 Jun 2018 06:34:19 -0400 Received: from trochilidae.lan (unknown [37.17.239.3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 955935C019E; Sun, 17 Jun 2018 12:34:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1529231657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:content-type:content-transfer-encoding: in-reply-to:references; bh=TKu9k3pkXk/ER6SiHJYzujn4jQk3e1WECqrw3PwNOsM=; b=v3Pfky/w1IxwLR6DUZjKow5qFISLwS21Fp4Gz1YHF/+KZnmLdIU5y7TxXdvBuyl+jz7jwc uUEJlwzJqCvQfD61WHfrerRXEC+GtG6cm5iQ5BLL9+H8dfgOh9I0AQlOWfkhK+G0S7VrNf uSDhAMVxm2xnbPHY2yhasO7mJxK7du4= From: Stefan Agner To: Kalle Valo Cc: Stefan Agner , Tobias Regnery , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , "David S. Miller" , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] brcm80211: fix wrap around in conversion from constant to s16 Date: Sun, 17 Jun 2018 12:33:50 +0200 Message-Id: <20180617103407.27819-1-stefan@agner.ch> X-Mailer: git-send-email 2.17.1 X-Spamd-Result: default: False [-2.10 / 15.00]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[14]; BAYES_HAM(-3.00)[100.00%]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MID_CONTAINS_FROM(1.00)[]; ASN(0.00)[asn:13030, ipnet:37.17.238.0/23, country:CH]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The last value in the log_table wraps around to a negative value since s16 has a value range of -32768 to 32767. This is not what the table intends to represent. Use the closest positive value 32767. This fixes a warning seen with clang: drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c:216:2: warning: implicit conversion from 'int' to 's16' (aka 'short') changes value from 32768 to -32768 [-Wconstant-conversion] 32768 ^~~~~ 1 warning generated. Fixes: 4c0bfeaae9f9 ("brcmsmac: fix array out-of-bounds access in qm_log10") Cc: Tobias Regnery Signed-off-by: Stefan Agner --- .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c index b9672da24a9d..b24bc57ca91b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c @@ -213,7 +213,7 @@ static const s16 log_table[] = { 30498, 31267, 32024, - 32768 + 32767 }; #define LOG_TABLE_SIZE 32 /* log_table size */ -- 2.17.1