Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp372975imi; Fri, 22 Jul 2022 00:32:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGkmadOgEeYONgR/a/eZECREpjvSIZruVO3MurRt93U3wdKZkr6zAPmA6Ffrvic5w+iK72 X-Received: by 2002:a17:906:844c:b0:72b:4d77:fd83 with SMTP id e12-20020a170906844c00b0072b4d77fd83mr2108446ejy.151.1658475126322; Fri, 22 Jul 2022 00:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658475126; cv=none; d=google.com; s=arc-20160816; b=ONur1wwYbfcAHNpCUL85YlIH+W3/KMjhk48oS3CfFqxtenqEUTzYY+85zRJ2Ht9OG6 kX4ax89zOoFPBlTqlUvU/YLLNJenwcjsLRWyxNk5m6DOEjtj92F2CbxrRTSyQl6xO2Tl k1/BRjWeGa0eO14pCQanVj4E4/0t555H+p1QUczxkxr9ckDIAwh2PkP05G9TrXTxwmxI PS30dZxNyH25munr7ZgqMaCJWcKV5Z2oFgQ6EBIzz8G8fRj1Dwc+7xwQErhKrrBfxGRs ixGwKozHxDZ5lhZiJr6CR9EiO69bm4ykB2/gAsAAL9MG+Y5K6IINL0LilVD/dQOynAf3 zrkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=B4Hy5WgIDA8MDhrVZeCSzDh9bIrR7DewLXi+Th66sO4=; b=aPXrtKsdis1mEbBSQkixT56LpZ01/wpdwYNET1JGLnMj3Xzr2cAR21soLkEyxgpQF5 GMUcZaimw4D5A2RI2H12SenRAXScKbfKYpIy0ByHhHozPHRJxyhJd1rfvwaz97abKHpb Vvtd0TQnOCJcmTBRdKgKY8g3+K+wI2VPouSI9goWQudGhacHRqS8hhSszDQTGu569g+W T+zd6tkeXhAeQKjOutGTnWvkfIn2NrY3ChqRqr5onEQ4VYSybzXvEzdhEVxDA9/8ymfV kv7Jg8XppebScW1xVINlcAVnUjtrRPCM1aaDMyWWrPVyk4H3qnmnJgUfRT+hvcujhPxS VFLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=VdeANNwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho41-20020a1709070ea900b0072af3c1acf5si5763350ejc.657.2022.07.22.00.31.41; Fri, 22 Jul 2022 00:32:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=VdeANNwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232768AbiGVHSI (ORCPT + 99 others); Fri, 22 Jul 2022 03:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234346AbiGVHRq (ORCPT ); Fri, 22 Jul 2022 03:17:46 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC1346370 for ; Fri, 22 Jul 2022 00:17:44 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id m8so4774538edd.9 for ; Fri, 22 Jul 2022 00:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B4Hy5WgIDA8MDhrVZeCSzDh9bIrR7DewLXi+Th66sO4=; b=VdeANNwCgjhfUld5l1Pc3g0E7LeDnDhLCBfGR0v3Hvw1QqvbErcHV/IeKhh/V4uswb 98nwmgJN175BsxWhBi6zmb0TJT8/E0Dqa6IDfMy1ZU2Q1hXEB0HvVlYb1HyU7ILlDpSg O9E2qDzXKgJGNP5WaZ9Ztx/HkaX5VVyKjQB4PI0+PyzUlGpoHoel9TnSHg93LW23eWqy iXHzA7n5W3kbfr+kpR19mf4HAS2uPZ/U9rBYQOf/nFNkM2zoUtM2PlD8JbG2yDU5J3Lm Uq3Q+C5tO4doplog5qpcyoJFO/xPFtF5B2NIHz+pBhYzKuK2XuhNRZkev/nSSy8XB6LN +LPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B4Hy5WgIDA8MDhrVZeCSzDh9bIrR7DewLXi+Th66sO4=; b=LnL4AaNRCiJgvVE4BcuNNdPnKf4GAEw0LF3rnna9bgQm/vusS0Wjqg6jogxyl5Ytfl wl4zejUDzy96XRjIgTlq2PkuWhD+YfZxMkipZpW6oAPQ4P8HjXAdabM7sHKDtP7Nk3fP sGAfkrYuDIb+hu6SdHNpTWwu0IVWWTP+9JvgE0PWB7H3InMIdAVBKHT1xxLzZrnRY7Iz H1D1E5W0HH5xF6Xq584BHM0Xn5PCQPscBGXHxNj1l3OoLB4wxCdn8NDXkFNCVA+u2Z7g mNulzy2GZ7Qv6IoXmEzEBu4pClKkg4b/HwaajfNgCCjKFEPPrs5F1s864Ak/pick/awO O9NQ== X-Gm-Message-State: AJIora+49Heynqk/d06CkA13ltKvf6mMQznijbm+U3OWzBqd2xJcMdeQ 33UoLB0bpiCBH/Pz+pp8PlhFtsf9YbQFQ+ppdaThkA== X-Received: by 2002:a05:6402:26d6:b0:43a:daa5:9f12 with SMTP id x22-20020a05640226d600b0043adaa59f12mr2038424edd.408.1658474263288; Fri, 22 Jul 2022 00:17:43 -0700 (PDT) MIME-Version: 1.0 References: <20220721073909.23318-1-srinivas.neeli@xilinx.com> In-Reply-To: <20220721073909.23318-1-srinivas.neeli@xilinx.com> From: Bartosz Golaszewski Date: Fri, 22 Jul 2022 09:17:32 +0200 Message-ID: Subject: Re: [PATCH] gpio: gpio-xilinx: Fix integer overflow To: Srinivas Neeli Cc: Linus Walleij , Michal Simek , neelisrinivas18@gmail.com, shubhrajyoti.datta@xilinx.com, srinivas.neeli@amd.com, sgoud@xilinx.com, "open list:GPIO SUBSYSTEM" , Linux ARM , Linux Kernel Mailing List , git@xilinx.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2022 at 9:39 AM Srinivas Neeli wrote: > > Current implementation is not able to configure more than 32 pins > due to incorrect data type. So type casting with unsigned long > to avoid it. > > Fixes: 02b3f84d9080 ("xilinx: Switch to use bitmap APIs") > Signed-off-by: Srinivas Neeli > --- > drivers/gpio/gpio-xilinx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c > index b6d3a57e27ed..7f8e2fed2988 100644 > --- a/drivers/gpio/gpio-xilinx.c > +++ b/drivers/gpio/gpio-xilinx.c > @@ -99,7 +99,7 @@ static inline void xgpio_set_value32(unsigned long *map, int bit, u32 v) > const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5); > > map[index] &= ~(0xFFFFFFFFul << offset); > - map[index] |= v << offset; > + map[index] |= (unsigned long)v << offset; > } > > static inline int xgpio_regoffset(struct xgpio_instance *chip, int ch) > -- > 2.17.1 > Applied, thanks! Bart