Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp771634ybc; Sat, 16 Nov 2019 08:24:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyAtjA8EbrVeB3RBaAidn6wEKjiXCPuViG84G44XoJSDcoWjIegh25LkKbHX1mXUIEuPuvE X-Received: by 2002:a17:906:3ed2:: with SMTP id d18mr10926162ejj.84.1573921475177; Sat, 16 Nov 2019 08:24:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921475; cv=none; d=google.com; s=arc-20160816; b=JF/attdBK80sJWYII7K8i4IeFx9iWYscleTfM9MIOcwh/XJJM6Y7iHj6OQaEET5K8f Ne6/lfLVbbr8VzRtqZsusOik4XuV6NABWdxPJGaS6qPxExHIS9OI1JgaSLJEivs8E2Ws Y33P4Kp5C9cE4lOe2ucT8cy8hWvzAj72HjEdkk12JMXETCZYOsxKpWDQYF6Sb2FKMHVO 1TZMkCpXIe9K/Hfy02fn+IkfpVXGtWB93JWU8ByXjufKFQcx6VxxWX80guW7k5JAMkpB UuEwNj2UcCZdFKHs3aCVWQHG078Oo9uo3hXu/Mc6HumiFPfKAsbbH6NWMB9nBWB2CphJ a43w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=akO/ZN/gB9E5gDwa1Py5Qjj0F1kulZBt1ksy60gLUBg=; b=oxrVjYF78gzfWhEa3qzXfJXU3QxtZ+9Q+QkqP6mSeQLTXyAKSpdhViQsc5Kbz/d6Ps dcH7zE9GaYY5L7kEJRLZQ+ag+CHLKbGrIrKZA8TzKyP5O0uWT9xwTSltFigmMR7AF73V hr9BObj9SJkD3rk5RtreIEfZYWS73mI32P0ILwBce8egxKi0DraYN0HFCz7FjlXLgDT9 ugyGL7gTBXyAc4ngcc505eSVHtTEJTV9Y/trsP+D1mY20fM8ghGXBnGu8igsNQ5z54tm Whxpc4kXfgVtAa/k8ywNHBOg0NM5P2utSkBiRWGNr7jGpbDXrgj3ykXy6yGchsKLa7Co a5Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SLBdnPd5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gg16si7848104ejb.256.2019.11.16.08.24.10; Sat, 16 Nov 2019 08:24:35 -0800 (PST) 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=@kernel.org header.s=default header.b=SLBdnPd5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728737AbfKPPn1 (ORCPT + 99 others); Sat, 16 Nov 2019 10:43:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:47362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728697AbfKPPnX (ORCPT ); Sat, 16 Nov 2019 10:43:23 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F75D20815; Sat, 16 Nov 2019 15:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919002; bh=dP+PCoNwoOWfPuFe01TtS/TXqgxB3zZdYBB2ROF1FZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLBdnPd5GxETlQbsYBgk4PnGHg02YNm6jE+1t93yvnHsTu+DYWTo6V0X96UnTrLYl UYHv2LDMMOTR9A7nhrgW0zqiGWm/EeZ13vYb+NnF/YNohoJ74o8BrUhd8UJBqHeBJq uNuvscSfo7szQe8XIj6n+3IR0hMZVRbnzMAoA8/g= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 4.19 106/237] mISDN: Fix type of switch control variable in ctrl_teimanager Date: Sat, 16 Nov 2019 10:39:01 -0500 Message-Id: <20191116154113.7417-106-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit aeb5e02aca91522733eb1db595ac607d30c87767 ] Clang warns (trimmed for brevity): drivers/isdn/mISDN/tei.c:1193:7: warning: overflow converting case value to switch condition type (2147764552 to 18446744071562348872) [-Wswitch] case IMHOLD_L1: ^ drivers/isdn/mISDN/tei.c:1187:7: warning: overflow converting case value to switch condition type (2147764550 to 18446744071562348870) [-Wswitch] case IMCLEAR_L2: ^ 2 warnings generated. The root cause is that the _IOC macro can generate really large numbers, which don't find into type int. My research into how GCC and Clang are handling this at a low level didn't prove fruitful and surveying the kernel tree shows that aside from here and a few places in the scsi subsystem, everything that uses _IOC is at least of type 'unsigned int'. Make that change here because as nothing in this function cares about the signedness of the variable and it removes ambiguity, which is never good when dealing with compilers. While we're here, remove the unnecessary local variable ret (just return -EINVAL and 0 directly). Link: https://github.com/ClangBuiltLinux/linux/issues/67 Signed-off-by: Nathan Chancellor Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/tei.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c index 12d9e5f4beb1f..58635b5f296f0 100644 --- a/drivers/isdn/mISDN/tei.c +++ b/drivers/isdn/mISDN/tei.c @@ -1180,8 +1180,7 @@ static int ctrl_teimanager(struct manager *mgr, void *arg) { /* currently we only have one option */ - int *val = (int *)arg; - int ret = 0; + unsigned int *val = (unsigned int *)arg; switch (val[0]) { case IMCLEAR_L2: @@ -1197,9 +1196,9 @@ ctrl_teimanager(struct manager *mgr, void *arg) test_and_clear_bit(OPTION_L1_HOLD, &mgr->options); break; default: - ret = -EINVAL; + return -EINVAL; } - return ret; + return 0; } /* This function does create a L2 for fixed TEI in NT Mode */ -- 2.20.1