From patchwork Mon Jun 14 10:27:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 459823 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3181544jae; Mon, 14 Jun 2021 04:11:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF2BsSrOwfvW7U5fcWPgBZOtC4UgK3Y00ri+hlhMBXznnum26LYvtaybGga3OfggnpIec/ X-Received: by 2002:aa7:d74b:: with SMTP id a11mr16300210eds.95.1623668997733; Mon, 14 Jun 2021 04:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623668997; cv=none; d=google.com; s=arc-20160816; b=uXJpz71HZwsNxDOrqPMFhdS1eXvEeIfHZhToYOP4HQ7C5yjjZUOeJ8xs69GaQmhL1r G7bMEHJom4zYyIuyYcEdFNx4OY4WfEK/Aq9lo7oMv+1r8JjksYQE6YzOK3+Az1f+EVA1 oYHdwJQuzUGSGr9o1/Nb7PISf+pU3oAOBNBNw0iPf5p2nGnLu25OdHv2ifaKND/uYZCm yrO/GSlwbQtMRY03PmeoCZ47UChgiUEerEmmICfbncA8ESQPpQn4XzVvhLlyR3sBe9Xw 5SUQbGbHdNoGFUqOi//fcfnzzf2YqjzZNuwIle+kGVEvD3mME9eaz1efQTuJ3qGg6tnK k6ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=adsvo7+gFsXc+lP/HyX7JwLGI+Tu6YfEU/hu+yUP06k=; b=fVV0byhqthZ33hHoi27p4ML0kwkD3hob8fM1Lg6VlTSj89vTENHrlHSwuk+ZeBa47Q T6GiVaa8SDruy827d60sruh6c/rkhPOERvBM29NKFlk23C+VYO9fFd7IdFf9MFSNWp1v hs53KXHSkc1XQsqgqZeKIASg3naBArQWmNOmnncSdr1+an4O5CoBv+ApF2gAuO2EJNcM kbIEj5UCvlkWkuVyzKXZX1fKAwXzcx65LtIWDMbe9Ih/CjGRFWTwtx8AZ7+/SBarss1h 2WZgpz1mN95X++k74jWzfuA6dxMJUQuu3SPZLlUMSIhu+fpXWTSzg8ihGTywXLXmOUSi 3k/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hIDRI37H; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si574263edc.212.2021.06.14.04.09.57; Mon, 14 Jun 2021 04:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=hIDRI37H; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234755AbhFNLL6 (ORCPT + 12 others); Mon, 14 Jun 2021 07:11:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235357AbhFNLJo (ORCPT ); Mon, 14 Jun 2021 07:09:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B657361456; Mon, 14 Jun 2021 10:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667617; bh=maORWLPVrr9ivQoLTNE0VfpAaNk2Qk2q3HQkmhtjt/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIDRI37H9S1XE3aQ72WyhL3YZJppW3i2+RLmj9Bfc6Q78xIUWopzbFFGH75+yghl6 wa26CX1bgl63uAQJp67GCjIiauUNgX9YNQD68dG7YS6Hw6AB69yIv63ROO/Q8tUTo+ XzoOgHO8MzIVTyUXgn4GYMGy9e1QC/5PRWTlNYak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Andy Shevchenko , Bjorn Andersson , Bartosz Golaszewski Subject: [PATCH 5.10 112/131] gpio: wcd934x: Fix shift-out-of-bounds error Date: Mon, 14 Jun 2021 12:27:53 +0200 Message-Id: <20210614102656.812266049@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Srinivas Kandagatla commit dbec64b11c65d74f31427e2b9d5746fbf17bf840 upstream. bit-mask for pins 0 to 4 is BIT(0) to BIT(4) however we ended up with BIT(n - 1) which is not right, and this was caught by below usban check UBSAN: shift-out-of-bounds in drivers/gpio/gpio-wcd934x.c:34:14 Fixes: 59c324683400 ("gpio: wcd934x: Add support to wcd934x gpio controller") Signed-off-by: Srinivas Kandagatla Reviewed-by: Andy Shevchenko Reviewed-by: Bjorn Andersson Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpio/gpio-wcd934x.c +++ b/drivers/gpio/gpio-wcd934x.c @@ -7,7 +7,7 @@ #include #include -#define WCD_PIN_MASK(p) BIT(p - 1) +#define WCD_PIN_MASK(p) BIT(p) #define WCD_REG_DIR_CTL_OFFSET 0x42 #define WCD_REG_VAL_CTL_OFFSET 0x43 #define WCD934X_NPINS 5