Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3015803pxb; Mon, 18 Oct 2021 06:39:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRTwyxmhjb49bBr+gvvMsctWuPOU/jisE1QRUtLc3jnYID8D/uxyC8M+SvhLNo1fCSzCAj X-Received: by 2002:a17:90b:4a45:: with SMTP id lb5mr46933555pjb.94.1634564369089; Mon, 18 Oct 2021 06:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564369; cv=none; d=google.com; s=arc-20160816; b=Ud3GbmS0wDG0Juz4NPz3dnBQuB6QY4ivob8/9ymt74yBnLdjEwKlXEObQ1WWLOa5D7 8KvUrdBheNsFooPXQQyMs5Knux4ioBsE5xYXCQ+Zk8bMm9M764mfcNa6sNh4AzmEuS0T sAEC2re0SrvxoUPlq0bbI7KpXDkoJ52wx95U7CHvgryT5KzSM+bJtojiH8e5nrN/7K7x cn5F5nVIH0S6Qg5JaWTiTsXwOjudiQUnC2kVemLA+rz9SwBOW69K2c4H05f5Fjxfqc/J xf6BkXzU1XPd4l5QVjiEBPl8BRCaY03SLgDlS81txodAb/2DDHspz9meZXNvTnvGLoD1 M2xg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ciopSObljGWGrnAwHoSzuMh+GbS64FpDpKCxyqRs75c=; b=wf1WKG+lBeZL5OD4tKEUQEiR9wnHEe6bpG8cHjUO0AY8/5OtjnmUWhCQNCWJHvBs6q UQM4GqXw4febPvHzyz6VzezHSxDwp7dfyymXGzZzgk/qMJkonH53fI5/OuUal9RTx/oR gZGCFFuG2Py+tPf+oPlkIasqGLhCD3m0lEITrbk/ZVBXLvaBU6nlgQExLqnI67gaMZq+ b4Bo2fNAE5zg742FItcsrWZuF5e5xLnYAPyvlq9McTy+nxQ4RpctrePBVCcghnmxis+l 0GSIn8xFNUk7spzM9xLZW1WZrMmpuXYN1Q/JJ9huWNSAEpIWoAEaDrLU0yPx/6qR2H4J Lw3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RGKcsDQQ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si18168411pgj.581.2021.10.18.06.39.16; Mon, 18 Oct 2021 06:39:29 -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=@linuxfoundation.org header.s=korg header.b=RGKcsDQQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233371AbhJRNkJ (ORCPT + 99 others); Mon, 18 Oct 2021 09:40:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:54084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233214AbhJRNhh (ORCPT ); Mon, 18 Oct 2021 09:37:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD86961360; Mon, 18 Oct 2021 13:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563892; bh=V5q8jqpNLEFvULBQ/nLGImYDqTsVmi2RD6LJkW5bd4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RGKcsDQQk0IbVvzY4xn348NFNrnuHbSSCCNTL4ZTzKgxbrioQmVH63E8ypqCGitOO mtoagQqFPRGm+7KtltVnN7CWcI3gXlUBVYTIXw79hxVkhmiN36EeoGFr22VfiWWuxF y+NL2FKxzxwRZ7uZVRq/cULQJ9MPjClGw6PmvvNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 5.4 22/69] cb710: avoid NULL pointer subtraction Date: Mon, 18 Oct 2021 15:24:20 +0200 Message-Id: <20211018132330.200323269@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@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: linux-kernel@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 }