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=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 09525C4167B for ; Sat, 12 Dec 2020 10:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1A9E20684 for ; Sat, 12 Dec 2020 10:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388311AbgLLKDN (ORCPT ); Sat, 12 Dec 2020 05:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407318AbgLLJyb (ORCPT ); Sat, 12 Dec 2020 04:54:31 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6230C0619D2; Sat, 12 Dec 2020 01:33:37 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id t8so8663011pfg.8; Sat, 12 Dec 2020 01:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=f1FArQJwKvbV3BehyF4qEYRVrF15VQjMltXB6x2VXEs=; b=VfglcvXKb3iG6utIOpUfYAhtiw18RAnZXn+8XlkXEyYi23SGNxEmGpmMtBJvmqNiwQ OIQVaVut6CGtqNUs5pftpzY7bdxIAlVW1LvP4gMmfgXjyMaswbb6tUjYn+9zZfiruEFA mVK1h31PnUfdKRNRvEaYnwUF48Kl1mFGBH2NyQpeJcN0xSx6z6Nxyn5a12Vcal50Z5Ok 1Cfqn72/66gvm3CAtIdmMP1WxOTYjRXNIu7G3e0rGQoeyWyeQ7EaluvMLFqhKYXeCUzB DCxEh/eOh9yijgAQ1PRTyvWD/TDKrFRMUgDxrAVcuRCzruLk4W4bdqjBZ9UPI3xc96+e pYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=f1FArQJwKvbV3BehyF4qEYRVrF15VQjMltXB6x2VXEs=; b=fqL6xJ6LPwjx0Y8DCFCQP46olE0HivZZbLJogXxOGVxAToumlDtOkCIeX6lrtMGlof zGQQPOXMdc/EoijgU8jXIViQvF8SQ0O4UXmOAdMXqrcXRtsdW6ezlaF5129U480szFzF ZRGDsilFm0lvZH13rOKRUW/xRY6Tfs/2ABfgxM9hcqQoIi+w9h2535+lSSYfQJtfwvmt 4BjHjuDUBgmc75J5Rlaqq+F1xD7kuKPcCWAuMzPM/cmFhyYEXxMfbYW5QdCDmB7AtRez 9Av+fV6fLMdWfa3yEmo0K5hOqF2gtrlAlJ12C/80AdnF30ZdxjrJoEUJuLyIN7EkwGXt jKWg== X-Gm-Message-State: AOAM532+GeF9etmQ4JvHGL4UQaY/bxkgpXwHFa4QecwltoFxLWYCAWy8 BjKj6M9ZA9zER0d50kyhjw0= X-Google-Smtp-Source: ABdhPJz5b/yhDHG5uH6YU/ZzFV4elj98QRD5Y6ho7DQz8+eoqDrOz5qWPGF+glH9iqDCk2RFt6pbNw== X-Received: by 2002:a63:d401:: with SMTP id a1mr15671694pgh.42.1607765617145; Sat, 12 Dec 2020 01:33:37 -0800 (PST) Received: from syed ([106.202.80.219]) by smtp.gmail.com with ESMTPSA id g9sm13902333pgk.73.2020.12.12.01.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Dec 2020 01:33:36 -0800 (PST) Date: Sat, 12 Dec 2020 15:03:15 +0530 From: Syed Nayyar Waris To: linus.walleij@linaro.org, akpm@linux-foundation.org Cc: andriy.shevchenko@linux.intel.com, vilhelm.gray@gmail.com, michal.simek@xilinx.com, arnd@arndb.de, rrichter@marvell.com, linus.walleij@linaro.org, bgolaszewski@baylibre.com, yamada.masahiro@socionext.com, rui.zhang@intel.com, daniel.lezcano@linaro.org, amit.kucheria@verdurent.com, linux-arch@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v2 0/2] Modify bitmap_set_value() to suppress compiler warning Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Hi All, The purpose of this patchset is to suppress the compiler warning (-Wtype-limits). In function bitmap_set_value(), add explicit check to see if the value being written into the bitmap does not fall outside the bitmap. The situation that it is falling outside is never possible in the code because the boundaries are required to be correct before the function is called. The responsibility is on the caller for ensuring the boundaries are correct. The code change is simply to silence the GCC warning messages because GCC is not aware that the boundaries have already been checked. As such, we're better off using __builtin_unreachable() here because we can avoid the latency of the conditional check entirely. Michal, What do you think of [PATCH 2/2]? Is the conditional check needed, and also does returning -EINVAL look good? Changes in v2: - [Patch 1/2]: Squashed earlier three patches into one. Syed Nayyar Waris (2): bitmap: Modify bitmap_set_value() to check bitmap length gpio: xilinx: Add extra check if sum of widths exceed 64 drivers/gpio/gpio-xilinx.c | 18 ++++++++++++------ include/linux/bitmap.h | 35 +++++++++++++++++++++-------------- lib/test_bitmap.c | 4 ++-- 3 files changed, 35 insertions(+), 22 deletions(-) base-commit: b640c4e12bbe1f0b6383c3ef788a89e5427c763f -- 2.29.0 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=-7.2 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,USER_AGENT_SANE_1 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 72CBAC433FE for ; Sat, 12 Dec 2020 09:35:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 11E6923D5A for ; Sat, 12 Dec 2020 09:35:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11E6923D5A 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=kNh7ZiRi9VnHQDSWMld/p2MCFH9YBwHzqlCBnQfT37k=; b=UMlRBOH2C2DbzC6V3wfuKkZCKz 5RxTu2PUFPqbA+nkPq+PeuQF1a4VTdDrdpWDCkZvzhuGEpupy+n6LfJ+q6XtdSP58mW/Dt8PejJJ9 M1m1wZsA/C5r6fMYOUl8DoOWf93JDleKeL5dbOuXHB19VOvoSPnjgsDuRjaiRheMEPjAiUbhwzdPk qznUKHoYcLSkAQrO88XeRzmY9UBcUrQ/IGvfeYwSnTLt6ClMiH4H6qb/chRBmvepRFxQM6c7Bd5dr KGXuIZdsGS0GoLgRZrmhqHNhxqfXO+sUtXALB8x0M/bTBvewGLa8IIwI7GVU3bP/qWcMAvZAtZQEb 1j76sKDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ko1Hf-0002RZ-Cr; Sat, 12 Dec 2020 09:33:47 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ko1Hc-0002R4-Ia for linux-arm-kernel@lists.infradead.org; Sat, 12 Dec 2020 09:33:45 +0000 Received: by mail-pf1-x442.google.com with SMTP id i3so8661228pfd.6 for ; Sat, 12 Dec 2020 01:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=f1FArQJwKvbV3BehyF4qEYRVrF15VQjMltXB6x2VXEs=; b=VfglcvXKb3iG6utIOpUfYAhtiw18RAnZXn+8XlkXEyYi23SGNxEmGpmMtBJvmqNiwQ OIQVaVut6CGtqNUs5pftpzY7bdxIAlVW1LvP4gMmfgXjyMaswbb6tUjYn+9zZfiruEFA mVK1h31PnUfdKRNRvEaYnwUF48Kl1mFGBH2NyQpeJcN0xSx6z6Nxyn5a12Vcal50Z5Ok 1Cfqn72/66gvm3CAtIdmMP1WxOTYjRXNIu7G3e0rGQoeyWyeQ7EaluvMLFqhKYXeCUzB DCxEh/eOh9yijgAQ1PRTyvWD/TDKrFRMUgDxrAVcuRCzruLk4W4bdqjBZ9UPI3xc96+e pYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=f1FArQJwKvbV3BehyF4qEYRVrF15VQjMltXB6x2VXEs=; b=K5pIbRUdRPLx5uPF8wY/C7tjMEDiTX73TsSPcjXwUoS8KPsbiZF32Sm+kio1QgHwQ/ Bh8zpD526s8NaNNbvWgzMdOo7PJt7i7hAlTZB3/k+ZEBKY54+LRMwAdMil7ziEZC6RqF zFurb+eKgq1AgDYORCx+z8kCavKER6oU3tqjBR25cMWGaIXpH5WvDSeqokYSsbs4tho5 iIOg8tFthGUxIMUpdJlQoPatpyNeDw2shk7xsJbFEvOqXFQVK7wdq1TplV0f1sfvF3Bc TP/EYetHIAdsuvBuYt5KaT43HVDbd4DS7gR3VK4/UpUbTlDfDj2YQwH4NPxYweZiR0PS I9ZA== X-Gm-Message-State: AOAM531h0craqt2wysdL4/rQl/nM3BHnX+H8mjQRmEAFDdQWZEC/OKgY d4aJ5dwQ4BNS9ZN1M20arXo= X-Google-Smtp-Source: ABdhPJz5b/yhDHG5uH6YU/ZzFV4elj98QRD5Y6ho7DQz8+eoqDrOz5qWPGF+glH9iqDCk2RFt6pbNw== X-Received: by 2002:a63:d401:: with SMTP id a1mr15671694pgh.42.1607765617145; Sat, 12 Dec 2020 01:33:37 -0800 (PST) Received: from syed ([106.202.80.219]) by smtp.gmail.com with ESMTPSA id g9sm13902333pgk.73.2020.12.12.01.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Dec 2020 01:33:36 -0800 (PST) Date: Sat, 12 Dec 2020 15:03:15 +0530 From: Syed Nayyar Waris To: linus.walleij@linaro.org, akpm@linux-foundation.org Subject: [PATCH v2 0/2] Modify bitmap_set_value() to suppress compiler warning Message-ID: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201212_043344_688767_61195E5E X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, amit.kucheria@verdurent.com, arnd@arndb.de, yamada.masahiro@socionext.com, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, daniel.lezcano@linaro.org, vilhelm.gray@gmail.com, michal.simek@xilinx.com, bgolaszewski@baylibre.com, rrichter@marvell.com, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, rui.zhang@intel.com, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org 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 Hi All, The purpose of this patchset is to suppress the compiler warning (-Wtype-limits). In function bitmap_set_value(), add explicit check to see if the value being written into the bitmap does not fall outside the bitmap. The situation that it is falling outside is never possible in the code because the boundaries are required to be correct before the function is called. The responsibility is on the caller for ensuring the boundaries are correct. The code change is simply to silence the GCC warning messages because GCC is not aware that the boundaries have already been checked. As such, we're better off using __builtin_unreachable() here because we can avoid the latency of the conditional check entirely. Michal, What do you think of [PATCH 2/2]? Is the conditional check needed, and also does returning -EINVAL look good? Changes in v2: - [Patch 1/2]: Squashed earlier three patches into one. Syed Nayyar Waris (2): bitmap: Modify bitmap_set_value() to check bitmap length gpio: xilinx: Add extra check if sum of widths exceed 64 drivers/gpio/gpio-xilinx.c | 18 ++++++++++++------ include/linux/bitmap.h | 35 +++++++++++++++++++++-------------- lib/test_bitmap.c | 4 ++-- 3 files changed, 35 insertions(+), 22 deletions(-) base-commit: b640c4e12bbe1f0b6383c3ef788a89e5427c763f -- 2.29.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel