From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from so254-9.mailgun.net (so254-9.mailgun.net [198.61.254.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4511029CA for ; Tue, 28 Sep 2021 06:43:41 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1632811421; h=Content-Type: MIME-Version: Message-ID: In-Reply-To: Date: References: Subject: Cc: To: From: Sender; bh=x8KORn26l3Mm682yXCu4AC83A+TMlzb+xY8KDLZycGs=; b=O/4ZDDe7kJUk6LaF4r/KA1kfh3Audih6a3glZ6IJtdbOL5P0MIumLeaKZYtT0hAmspr/kqAs OSWLPAHvpLS98am0bFiBJA5XCH4uhXfLw4c62T4zZnvOAJCYYRUz3dMHqdqPUt4uM5uxS126 rajrSsnmN+xKrcouIfz5/sK4Zms= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyJmNGYzNyIsICJsbHZtQGxpc3RzLmxpbnV4LmRldiIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-east-1.postgun.com with SMTP id 6152b99cb62327f2cb11ccaa (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 28 Sep 2021 06:43:40 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 49463C43616; Tue, 28 Sep 2021 06:43:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from tykki (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 71802C4338F; Tue, 28 Sep 2021 06:43:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 71802C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Kalle Valo To: Arnd Bergmann Cc: Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Arnd Bergmann , "David S. Miller" , Jakub Kicinski , Nathan Chancellor , Nick Desaulniers , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] mwifiex: avoid null-pointer-subtraction warning References: <20210927121656.940304-1-arnd@kernel.org> Date: Tue, 28 Sep 2021 09:43:32 +0300 In-Reply-To: <20210927121656.940304-1-arnd@kernel.org> (Arnd Bergmann's message of "Mon, 27 Sep 2021 14:16:35 +0200") Message-ID: <87wnn1qjxn.fsf@codeaurora.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Arnd Bergmann writes: > From: Arnd Bergmann > > clang complains about some NULL pointer arithmetic in this driver: > > drivers/net/wireless/marvell/mwifiex/sta_tx.c:65:59: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction] > pad = ((void *)skb->data - (sizeof(*local_tx_pd) + hroom)- > ^ > drivers/net/wireless/marvell/mwifiex/uap_txrx.c:478:53: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction] > pad = ((void *)skb->data - (sizeof(*txpd) + hroom) - NULL) & > > Rework that expression to do the same thing using a uintptr_t. > > Signed-off-by: Arnd Bergmann I'll queue this to v5.15. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches