From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C0FC433ED for ; Mon, 17 May 2021 07:09:17 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E0A360E09 for ; Mon, 17 May 2021 07:09:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E0A360E09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NZUC6I2ymDy4OsqfmdUb4XVM13ZesMXZP9b/rdAz8Lk=; b=ZvXAKmlXZehguz5N58/WkOEsR 1y2E6p6AJaT6NHxuIil96Fnt0UId0YwAU8pBICeY0ZFhtVE9C3ea37CzMsj0jpSKJB1XsPfww4pGj HBXD1qdhNbl/vFH/sUVnWcvI2PyotbLpMNAmQJPFwTSNUTOSoIe27DWJS+05GP0bXtgOS5G4jNLpj ZDBnMvQB28q2aWpLue39Bpa6uUZbFKa8RvXpLfUx8yRAm4y1T8F0kiV5T+A+dzBJTJxq4VRSVabld 8b8+GitY/frt1AK9jn2z2Wl9yHvfOhgkA34Its/1psm99VeNxoFfOk02roQe4R3MNzsIspkrFVsma EvZnmDUUg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liXJf-00DzTg-D6; Mon, 17 May 2021 07:05:27 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liXJa-00DzT9-9n for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:05:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BAtgXmEjVS9Lr7QYLFCDa/lR4136fUKXGdOTU6CO3Nw=; b=KBhilWrT5Kp23Abftsqw2gzvG1 1hjRc/8mvfeC0FwOn7j7OPSnPxSNtrYFCJv0KSSSVL3fcKt53eId13Wo2MU/oK1RMKVBaqOalTG1r cjToSWdcKGul75NCCO2p70vZe/1uuoSla9xAqXbYUyrlir8KSLkYrZosS1XHbDXpjrklSOGHPoOPu zu4I5gCTQDitSZNyihyE2nUbv4XheOSc3e1ogjdvuX+aBSC4Q5K8wfXXSg30jxABysXv70Qy+9Uk/ mHwZQwC/DONSBPTHuiupsHlbZh2pPEcP2KFSB7s4u5LQbR2I/nSHBZYxOaIlMlKGZDiU1SS/UJiG8 RsBeckzg==; Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liXJU-00DX8h-Iw for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:05:21 +0000 Received: by mail-pj1-x1030.google.com with SMTP id gc22-20020a17090b3116b02901558435aec1so3151334pjb.4 for ; Mon, 17 May 2021 00:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BAtgXmEjVS9Lr7QYLFCDa/lR4136fUKXGdOTU6CO3Nw=; b=E6+zNoW1SSwDyM4BKK6Pnzxx5XYNQDFpK7dmVLmF/0Pf1DiC2PDCjbzk88GxxHrpaz ui4QZq0PdvP6zVfucMscsz31lAID2ge2pKVjUzO0WN9c3wTBy43p3SRSYuCMpRoKPVsb dqiHXJ22ggH4AZz1yoVN2Wnp+3DoBLqPICjgUtl4K0s1lrPdcnXaa/p9GqhIxt95CRjT hvX2wcz3HFHSf6f0morebBrDTshKbQzJzbDJ96xNdxSE8ITbtyhHpjr/t/rIra2+wCQG 6an7GLkS5TBHqL4dy5EyPlfwTtiFhQEUWMmq61Y+/+OU4vOcTuDFAYc+fNrprGVItpjl x+Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BAtgXmEjVS9Lr7QYLFCDa/lR4136fUKXGdOTU6CO3Nw=; b=lqDl3Ds1G+OmM0ZrqKKhvBpcEW1ri0/YUIBawQOWAGSiv9WvxqzXFpYRd62/mRiwgO 5qsjoEdr77QUMd7rIjtdqrfrmK1Ay6/+qhG1anwwyq0AJsZhmhmHwMbk5xzYLLW102nr 0jxl7vwqDqc6gcznbEgUgMY/aydkTBptvRj9niSimm3zinIw9c1kQrlJZSr0KtctF/W4 /GHEK8HFWWB9BnhLungA490WFeRY5MZFhLZVX5cjFEDScg7BIbA/2cWIaVFsB1yZBV5O vU8IZtda3nF5USdTmZNVaw4m/OPzivyO/5O7v9+fJ+mObb62wSJQ1Y2CnjFQj+AM1RwB oalg== X-Gm-Message-State: AOAM532hvf1nb8m1KOXgoXpSCG1YLGXhOshfECH/AsHztsmNtDhphBZ0 KmvAuuNudFtsDZyqTcA8HbqCa03VwpUmyvafQ7w= X-Google-Smtp-Source: ABdhPJyqF+o+4ZWFScsTFOEr20R8wR/0TlcoXAxKSDuSS7Rjs6Cx8+b+97X2qPXnsj1fWbgSc87SFcC/xvmpOvExbmU= X-Received: by 2002:a17:90a:6c23:: with SMTP id x32mr30213143pjj.228.1621235115869; Mon, 17 May 2021 00:05:15 -0700 (PDT) MIME-Version: 1.0 References: <20210513085227.54392-1-colin.king@canonical.com> In-Reply-To: From: Andy Shevchenko Date: Mon, 17 May 2021 10:04:59 +0300 Message-ID: Subject: Re: [PATCH][next] gpio: xilinx: Fix potential integer overflow on shift of a u32 int To: David Laight Cc: Colin King , Shubhrajyoti Datta , Srinivas Neeli , Michal Simek , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , "linux-gpio@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_000516_663483_E5545E62 X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 13, 2021 at 1:04 PM David Laight wrote: > > From: Colin Ian King > > @@ -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; > > } > > That code looks dubious on 32bit architectures. > > I don't have 02b3f84d9080 in any of my source trees. Can you please be more specific on which code is dubious on 32-bit arches and why? > But that patch may itself be very dubious. > > Since the hardware requires explicit bits be set, relying > on the bitmap functions seems pointless and possibly wrong. > Clearly they cause additional problems because they use long[] > and here the code needs u32[]. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel