Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp618256pxx; Mon, 26 Oct 2020 17:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8hmzWQzxCkRj/Ma/LtqMK5pblbpyhLa4qRakV9uE3kGkedDUTrjF2A8PqliEaSgLlSbeH X-Received: by 2002:a17:907:366:: with SMTP id rs6mr18197989ejb.352.1603757089795; Mon, 26 Oct 2020 17:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603757089; cv=none; d=google.com; s=arc-20160816; b=r8fmzP83TGWYg4SXDgP16erjQlp5WWaimyPkYU8j3p1bz8cuWu0nCX1jmHOaKApwi7 +F/7OUmFNpUY+PV7HK6I/TwQW3oBEqpNoVIXBd6zC3+4NOrxtfEII2Foo+z27VkMoAHS fPvTPwKHlHTAFfts29i8t36I7HhZzq5FoQV1k2pchyse+7m2oqe0nBeQV0RJGMf9qMF2 qj9L4J9Z/+B/vNlCogrqKJWeG2cRMy+UGvpo+HPgl7OmiIjqvKRNWmlTHgoFBdHSvvng vkq1g7O3nyz//Dq7AKcOoqmnNqImLCPDgihk0qxlfafdnHUVrzuxBjb26NRh5HzvpVF3 tfjg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=q8JPbSC2ByL5rU4JiWR6zQVAbrLOu0gLWfMzC1oWubw=; b=tAmPmz19yGAZqiSFVuZv8faIx1ZKKbh2GQtCbX1vl9oxE9Y6SWv9afZPFQ9bOZHaEK MwNoDr0FL8WZqS6fD+JRAUITVoRUmgLoe11MsqBuN7BXo0+JmURc/3Kew2dTlIjYPvpm ix4vLdqdO4WcVkYeNuVkqAWQk/gFSNmHghw/wBecEJJzCCtghhMm0knjrMBoBfuHJDRr eeJhXUhKB8c/EzQyPwJSqLytQCquxnUOBJdbfIBDrdqG4gcRiD+v666HPZYFGwUYAtQF W/mqOa0R6vTlhEHYLnHYzNZwlfzI5s7zFLpdDaoAgsMf7K2AWXvSVXFhl9WoXU2hjTae E/rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmkM87HX; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs4si8079343edb.290.2020.10.26.17.04.28; Mon, 26 Oct 2020 17:04:49 -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=@kernel.org header.s=default header.b=AmkM87HX; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387692AbgJZVas (ORCPT + 99 others); Mon, 26 Oct 2020 17:30:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:43456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387588AbgJZVas (ORCPT ); Mon, 26 Oct 2020 17:30:48 -0400 Received: from localhost.localdomain (unknown [192.30.34.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89612207F7; Mon, 26 Oct 2020 21:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603747847; bh=LD/9TNQnrUu8vBtBBBr6HN9mRHCkAG1JzcNRgZIuFss=; h=From:To:Cc:Subject:Date:From; b=AmkM87HXTYOCoxtZ3kxeyJonodGVFniSH62c6M7OzRrU8+N82YsLKy8GQfhknXMoQ EJnJwtPL4O1f/bRdbnzjiV0cWYFs0IMExwD8Ol6AXLexHL/iCKvzbDwCHurw4P/4Q8 nPs6vEnKFjZKCaNEVqvangcN+b2T5/Z5fkzvwvjI= From: Arnd Bergmann To: Chas Williams <3chas3@gmail.com> Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , "David S. Miller" , linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning Date: Mon, 26 Oct 2020 22:29:48 +0100 Message-Id: <20201026213040.3889546-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Building a "W=1" kernel with clang produces a warning about suspicous pointer arithmetic: drivers/atm/horizon.c:1844:52: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem) The way that the addresses are handled is very obscure, and rewriting it to be more conventional seems fairly pointless, given that this driver probably has no users. Shut up this warning by adding a cast to uintptr_t. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Arnd Bergmann --- drivers/atm/horizon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 4f2951cbe69c..cd368786b216 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c @@ -1841,7 +1841,7 @@ static int hrz_init(hrz_dev *dev) printk (" clearing memory"); - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem) + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem) wr_mem (dev, mem, 0); printk (" tx channels"); -- 2.27.0