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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97333C433FE for ; Mon, 18 Oct 2021 13:40:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B94761A62 for ; Mon, 18 Oct 2021 13:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbhJRNmu (ORCPT ); Mon, 18 Oct 2021 09:42:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:35684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233600AbhJRNks (ORCPT ); Mon, 18 Oct 2021 09:40:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B9A861452; Mon, 18 Oct 2021 13:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564012; bh=V5q8jqpNLEFvULBQ/nLGImYDqTsVmi2RD6LJkW5bd4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xp1AQsGn8ATI+IZvQBU2XKF8UdUztiXp2GH8BpqcO1Xgh9tm8CP7T4fMtS8PCiYyL Qx9ZqeqE7BVcBGuvZL26Uis6HEf94Fiket+DJmxBdh5ra/XAaS7eUrG5Ai5NRPdw2b Yc2ELamCtRsOzGJW/k8wD77mrSWGKPTxmqQ1k+94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 5.10 031/103] cb710: avoid NULL pointer subtraction Date: Mon, 18 Oct 2021 15:24:07 +0200 Message-Id: <20211018132335.770620578@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132334.702559133@linuxfoundation.org> References: <20211018132334.702559133@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 42641042c10c757fe10cc09088cf3f436cec5007 upstream. clang-14 complains about an unusual way of converting a pointer to an integer: drivers/misc/cb710/sgbuf2.c:50:15: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction] return ((ptr - NULL) & 3) != 0; Replace this with a normal cast to uintptr_t. Fixes: 5f5bac8272be ("mmc: Driver for CB710/720 memory card reader (MMC part)") Cc: stable Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20210927121408.939246-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/cb710/sgbuf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/cb710/sgbuf2.c +++ b/drivers/misc/cb710/sgbuf2.c @@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy( #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS return false; #else - return ((ptr - NULL) & 3) != 0; + return ((uintptr_t)ptr & 3) != 0; #endif }