Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1813066pxb; Wed, 10 Feb 2021 18:22:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8u8M7jpMddalSN45s/k6vp6hDMT3zFUn9fks+TfIxBO1dCWDNGeUdztRpoUVYu0KQcZiH X-Received: by 2002:a50:fe02:: with SMTP id f2mr5807680edt.195.1613010141627; Wed, 10 Feb 2021 18:22:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613010141; cv=none; d=google.com; s=arc-20160816; b=TBJV1pMAqHyMeCMP7PKLRHgZGB1Q3ESplJMHw0WYtc5d0wMuEbFSEYf80HHnBKZM6K dKZpFWaRPHxfozhOZcnmdmdiPk28TUsCGFa5xl2P+2J55bv0DbMLJx7QwlgjrPSPiyNb +eYtdmr3P5gRkWUIcieVPgPwwpv3HE6jQA1g1BUHN7a2HDK3og5CSrZBY9y046USPSUG MXcKtdQZUieTK3+bt2Htd83CsRqWIj5Me4v5e2Fsd7yXNHPCTX7AcrRzovL5EVmSWHRl X/yK0+QI/i2rD907ToI7lmjGYUo6KerjuaBNEwCEvOmuSubH66uvG8Q4x1WBF4nP7xtB 0P6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tET1mVnOtpoLaS9Ukqysmq6PJCZiEJyq4Vl2DfUtenQ=; b=mMeOZCraiGCLAiujxMU2fPL00wUx0xQBaEYrKvU/T17SXBAXXKBojQfw9P7+MUOq1E P1mKx6EcAitM+GQb5CQgL8CJ4s4qHu+SEBc8HieRxBHkLL2pOhBtb0dNUkzcIQS5FPNc hbvexVAIovjdFEgsP+2a6gOpjyaTqwnj4WRr9XYxYAesO3zIJ6vNKRSyLJQil3yCA5lQ /bE+fozs1vbRODSAF6/rLPLgazssuvh80B/LJZe4VATmFSztSBgsruVlPNT2rF+jYVFN h1Ltq6x2MVUHrs2kma/1Psn9ZLZ0FZs6kJE4e0UgGOZW1/HQASgXQezs3JYNdR62+ou6 SjUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=Jr48N7n8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si2707104ede.341.2021.02.10.18.21.52; Wed, 10 Feb 2021 18:22:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=Jr48N7n8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbhBKCU7 (ORCPT + 99 others); Wed, 10 Feb 2021 21:20:59 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:13061 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbhBKCU6 (ORCPT ); Wed, 10 Feb 2021 21:20:58 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4DbgMJ6Nxfz80; Thu, 11 Feb 2021 03:20:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1613010015; bh=GmHC768vuaP1liy5q0cWcD0y5WVzLpTLzp28MwacV28=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Jr48N7n8S8tiRQCxkrkc6wIAHhlUY4bp3QnkxuhuX6qBr6lnsE0Cx+oOAyXcZdwzf tN/H10cVkgI3P6d3eST88tbroNogxN84qSQAkUcnr0kehvJVvx/jSHgq3z+RqKPpHi aCF7H6wPzRsdpYh7ExeI1PBDvL5HQkPzjoGvYBP5hIPSrbZ28NcrTBrQPXOPn/izO6 C8KOctyjyYg9HlPKILqWK6TTSFVx8Cbsz6eqy8WwBblja74qOxuAT9pxpGZgXikMRq F8iT/zQH//eWkryzZyU/sthk6xAcgLecquNP4hWiVtmTCU7CLBdod/NAHFEjHITXS7 nm0eg4r8c+Feg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Thu, 11 Feb 2021 03:19:44 +0100 From: =?iso-8859-2?Q?Micha=B3_Miros=B3aw?= To: Josh Poimboeuf Cc: Dmitry Torokhov , linux-kernel@vger.kernel.org, Peter Zijlstra , linux-input@vger.kernel.org, Randy Dunlap Subject: Re: [PATCH RFC] input/elants_i2c: Detect enum overflow Message-ID: <20210211021944.GA4933@qmqm.qmqm.pl> References: <59e2e82d1e40df11ab38874c03556a31c6b2f484.1612974132.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <59e2e82d1e40df11ab38874c03556a31c6b2f484.1612974132.git.jpoimboe@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 10:25:28AM -0600, Josh Poimboeuf wrote: > If an enum value were to get added without updating this switch > statement, the unreachable() annotation would trigger undefined > behavior, causing execution to fall through the end of the function, > into the next one. > > Make the error handling more robust for an unexpected enum value, by > doing BUG() instead of unreachable(). > > Fixes the following objtool warning: > > drivers/input/touchscreen/elants_i2c.o: warning: objtool: elants_i2c_initialize() falls through to next function elants_i2c_resume() > > Reported-by: Randy Dunlap > Acked-by: Randy Dunlap > Signed-off-by: Josh Poimboeuf Reviewed-by: Micha? Miros?aw > --- > drivers/input/touchscreen/elants_i2c.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c > index 6f57ec579f00..4c2b579f6c8b 100644 > --- a/drivers/input/touchscreen/elants_i2c.c > +++ b/drivers/input/touchscreen/elants_i2c.c > @@ -656,8 +656,7 @@ static int elants_i2c_initialize(struct elants_data *ts) > error = elants_i2c_query_ts_info_ektf(ts); > break; > default: > - unreachable(); > - break; > + BUG(); > } > > if (error) > -- > 2.29.2 >