From patchwork Fri Nov 20 17:42:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Syed Nayyar Waris X-Patchwork-Id: 11921437 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 8CD31C2D0E4 for ; Fri, 20 Nov 2020 17:43:36 +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 EFD862222F for ; Fri, 20 Nov 2020 17:43:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HWVYwvs1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VI+nmxvQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EFD862222F 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=BiHlgoWxIa4wq54IYecLpKowrAGh5XBQ6rBT/T89odw=; b=HWVYwvs1f9a7/7qDLhqzrdr6qC 4E2CUil/+gRl3ySdYzNMoy+B1+R6XzZ1kZ+o+BZjnInRt0YU+u2QbVXJoOycClEBQwRSNi7Cv7Dx9 0T+OGbdqqiqMjcIDeMPdl/o3NAUHtCCFFeLjWD/isLSFYoGg+rw/UjRZCkoshgoAgGjMRLimLtr8i OhFzkeoJExeLCEHlVSAYtKgl30L9DZhrvJmCCZm8kU4PHmNTqWty0stNupcDQn6MqNFZYSM5VIxxp 9vNl+ynruyGtgtwNrc6LRe0TtvfdrlwqtZnNHiWvAhompMt80ygRD2aRG6n/l+e7fFXNxM3zgzCm0 py352jDQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kgARD-0002eq-Ce; Fri, 20 Nov 2020 17:43:11 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kgARA-0002e6-VT for linux-arm-kernel@lists.infradead.org; Fri, 20 Nov 2020 17:43:09 +0000 Received: by mail-pf1-x444.google.com with SMTP id g7so8557128pfc.2 for ; Fri, 20 Nov 2020 09:43:07 -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=kmuAYSzMoeIo0u18AuX5Dattf9rqR9IenRhvLXpBl38=; b=VI+nmxvQg2sUIWi35kqMfRMIJ3Fz8czvVaSR7G1Zfgx8FiDgqspZLIVJIoQgfC9/3R vgz47lVm4b0zgiQWEYEx81MnYUa2OckpIPL38evGB35D1ZIZ4z3C6jfnGOMTuI4V37gg S58LIbJR+YDRJBM5FVzE/MB6eps76AZ2nUezRy8tqpv5UlRaXRE9NXvHEN+1ySEC6D4z AfLBNuhEaJeBvJlolW8rXubLak9FFD//01PhNq+ZDDvZCN2mRQjfAfXHQc8hUrbM3/vN utzUzUgJU5a5bbWo6r39NcOShTjktTO2Kq5lUDWytCUWlYZWAhiyXL3gewy0MCVHJYxt cVuQ== 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=kmuAYSzMoeIo0u18AuX5Dattf9rqR9IenRhvLXpBl38=; b=eF3pl60KUcy6WVy8kANwuc1DHIcoYXi86c/eneDLe1xp/QQO31aDQNzVLVSTO/adYp 42lDfsjmGQ/pqzAR4GYDaVwVY5SP6orHPVQrR/QOCgyonX7LtQCoz7OnvQFCrX72BOEA dcdCmXL9FuOWVpXX9y7QhKhdUu60lHHFRKBEy+kW0Hs5SmTqR2VTA/oAg/nfJWR7DrWx jlQ2ytXSuKJO68eD4LHCucv8WEYIC1XBrWMdb0EYeG6+vp5K4HnFVOZVBiid2jrAijfB ytiFS8xCGT73Urp8yVfQ5YJ92L2Ext76F3rWS1cz6E/bvaajXC/2eKRdTSbEU9eYaDOQ Zwfg== X-Gm-Message-State: AOAM5303qxNPBeKyR9a/TJAafy5A2R8dHy76fW5aXb06t/16HTb0KZob qoB7jXIdxHm9HBFpJty7f0Q= X-Google-Smtp-Source: ABdhPJz/l0AJ+PJtLuAfYLcSRppjH0Yz5mla4ScCRnKm4ezN8+CXxzOdqZOJxDwSuNiM5cQWBdyCRQ== X-Received: by 2002:a63:9d8d:: with SMTP id i135mr18423403pgd.213.1605894185560; Fri, 20 Nov 2020 09:43:05 -0800 (PST) Received: from syed ([2401:4900:2e82:cfda:fc82:287b:3e19:db98]) by smtp.gmail.com with ESMTPSA id y19sm4284226pfn.147.2020.11.20.09.42.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Nov 2020 09:43:05 -0800 (PST) Date: Fri, 20 Nov 2020 23:12:44 +0530 From: Syed Nayyar Waris To: akpm@linux-foundation.org Subject: [PATCH 0/4] 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-20201120_124309_038849_4BEE6346 X-CRM114-Status: GOOD ( 14.21 ) 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 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 4/4]? Is the conditional check needed, and also whether returning -EINVAL looks good? Syed Nayyar Waris (4): bitmap: Modify bitmap_set_value() to check bitmap length lib/test_bitmap.c: Modify for_each_set_clump test gpio: xilinx: Modify bitmap_set_value() calls 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