Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6017811ybc; Wed, 27 Nov 2019 13:29:33 -0800 (PST) X-Google-Smtp-Source: APXvYqyqkkQn8FZRSdz1QaTU6p5vGCySVXyzl3DX5SAB4D1Y6h8xvF55JHXldunAwm4rm5rcSQtp X-Received: by 2002:aa7:cf83:: with SMTP id z3mr9302165edx.166.1574890173603; Wed, 27 Nov 2019 13:29:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890173; cv=none; d=google.com; s=arc-20160816; b=tdfvg3csYlITuCg9u6qg/dzXVqYuCBqHZ4+pZQb2SKV+CQCgw7rJwrO8VpGpSXKXAt vY3Xk7QupCPyLUQ9jMRV1zZjYq9jFbO0J0oYyFmE0G1EkGRPtEDW3v9Gqkb8qTkQ+/N/ +J3/viNh3n1GHEWZFMvjTl01ylDWY8QlO+Z9FSvwCHbPVGC3C6DeWJWBqQwqhPJIElVO 17KcoDIOdM8fj7kPkUoUzYblQtFrI5rrOGUwokFi/31rmYfFWb2iltfWz309xp+2WrXf r8QZsGZeVxEaTvOoLW+bFtW09uaSMz6hBlIAg/eKAL3VgcllcF5ItL5oyJfK0SLnYYdq ip5w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=akO/ZN/gB9E5gDwa1Py5Qjj0F1kulZBt1ksy60gLUBg=; b=mOsa3V0xJFt7iU2i+SrGsFIigpIwPjj4szZsiYuS8fRnP7/iXHYBwJupcBdi8iHeXH 3TV0DrpdXJqC2O9bF11VZfBzk1T30jU5DwjtIIlXhpH5VrJ6kWJ/ICaJ2SaP9HQ6Qhm3 ayOlvF8CLu0h8LjCmmE8GxxskGClwHY9QMpt+74UghGPBsg0xIgbfLELtItKrR/IRo3q gpsiuWOK4TSXSjO5ri18f2e274wM79STPEDEBUVfDEBuyXtam/3aA/1aauZ6hTS7NhhH qVFCM3Bp6Bm5Joj75hHgQZQHNc/tC7SlrYDPG/8EAUQKJZaO/bzL9WEYJwc6LcTsc6KR 8aqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Xv1/ZT+r"; 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 o28si12026042edc.353.2019.11.27.13.29.10; Wed, 27 Nov 2019 13:29:33 -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="Xv1/ZT+r"; 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 S1731718AbfK0V0t (ORCPT + 99 others); Wed, 27 Nov 2019 16:26:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:51988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730957AbfK0VAN (ORCPT ); Wed, 27 Nov 2019 16:00:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D88B52158C; Wed, 27 Nov 2019 21:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888412; bh=dP+PCoNwoOWfPuFe01TtS/TXqgxB3zZdYBB2ROF1FZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xv1/ZT+rsKVgSTgFRprpWDUPL679QlGlo9ng274B5QEtezwXuIZEeJQMF0biXsE5/ 4wNUam5jLTnLcKPamWTTFQJQI+z1U5cfyojblQ5xjRllYGGn01oI94sDv/GOO+cwqU StklvvUoSp+xHqNXGeZgxLgpGe1hUjO0F1qnW3IE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 124/306] mISDN: Fix type of switch control variable in ctrl_teimanager Date: Wed, 27 Nov 2019 21:29:34 +0100 Message-Id: <20191127203124.183945021@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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