Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2663625pxj; Mon, 14 Jun 2021 04:21:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5mkkS2qJDk62Fh6Ql6k7hUsZ0M4RurrWXWZkNiD7qs2v8WdR1ZRKGTPyn2zTXWJgtFRCK X-Received: by 2002:a17:907:9607:: with SMTP id gb7mr14964315ejc.208.1623669715947; Mon, 14 Jun 2021 04:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669715; cv=none; d=google.com; s=arc-20160816; b=pyIU8EPhNh23utCywVb3WjCh6H8NJnV9TuHNvfT1Tadg2G958gJkVdnGIvtDGCQYHI 2xtQ4R5s+lNIMk7RJeTeOEfwa4Htq1THxLvE9WvG6XRgtKcWGIQ43uXSbPUOK2ixHC/d y7ET8jBXhCxaMJ81RaDg0Qa8Pn7GAwT1NR+3VfYgbbKm9WsmZz6r5P/oFLm9kK2OvDh4 u9CXcJptHWfVPc9qDB+d4haFF6nuz+dHAakhbAGyZ1ZmU4LA7Fx4xcfwVxkrc5RFE2kC 3CKWaDUrRgMQJhxVVrzVEZH+Kq2reFbrM9EQ146YQ1gsQ9UWLiZ6x/xt62DY01qIcPZA KNKw== 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=z6SpFqfV1GTpgIpvS0oAfXby3aUY5fJ/pBjpKF8zh6xgiXF9/0kJwvhKmLUJACRpD8 pvvWUQO5jjHR1/s9Vjw2GgP6rOCOEC4ME0hManzkuWYcmEhFr8UfGY1uqKzC+RIdKILX TVrL1R/h8WvoTd2UKcqOQtv/3GWksCs9lqwkkSTn4+owbZgaLcbH/v8aYE3mO9Hb4fRg QVkUFe4qghUer+m4qnyaupFVhFwDc0acuJnrHh80lPxL2pIJKeXJccvc8hib/9leWAO0 T06fGCYP5kJ/ISrGNtDi1j5vplFWtqBWrPjiACtnLuABVgD+1GQuNX9o/LE9tiyMcs8P 3v5Q== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 e10si10672534edz.393.2021.06.14.04.21.33; Mon, 14 Jun 2021 04:21:55 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=hIDRI37H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233533AbhFNLWC (ORCPT + 99 others); Mon, 14 Jun 2021 07:22:02 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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