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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A791C433F5 for ; Sat, 2 Apr 2022 15:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357399AbiDBPrj (ORCPT ); Sat, 2 Apr 2022 11:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357387AbiDBPrf (ORCPT ); Sat, 2 Apr 2022 11:47:35 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF3B164D22; Sat, 2 Apr 2022 08:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qrD3dLInNfleLqlGuKhkZmbWrdw03gFeC7x6uS63Upw=; b=fgT1s3C0m31iB+jxF8elaB2Ur1 KV8NTuktgsQyRbCUN1IhPGKFP4jqRt2oYZReQr5NgEyzb3bxttifzIXyv/jqIUxDbN3eBvRyPc2Qq 7360sHDlk9/k+xfzMUGKTUXq5fx//O8pvJmRA4dpwamuln78K+WBCTBaelhk5WFsYL9cICIMt2bVz PH7wr5YRIii8EPyI+/sD+0s0LyDJnlssn1tFVEkS2e0l+/steVQCDS6QzhO3pcNxq1ZZ8qJHGv69I L+xyI73E1TF7toXK+lRVsRKx/GjLccZtEsxr0iiC+qwUCTUmdy7DVF0h2DrHVIn8QXNKnqUHFia7C B2Ce7yig==; Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nafwO-001rxq-I0; Sat, 02 Apr 2022 15:45:28 +0000 Date: Sat, 2 Apr 2022 15:45:28 +0000 From: Al Viro To: cgel.zte@gmail.com Cc: rth@twiddle.net, ink@jurassic.park.msu.ru, mattst88@gmail.com, lv.ruyi@zte.com.cn, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Zeal Robot Subject: Re: [PATCH] alpha: add null pointer check Message-ID: References: <20220402083436.2413189-1-lv.ruyi@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220402083436.2413189-1-lv.ruyi@zte.com.cn> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 02, 2022 at 08:34:36AM +0000, cgel.zte@gmail.com wrote: > From: Lv Ruyi > > kmalloc is a memory allocation function which can return NULL when some > internal memory errors happen. Add null pointer check to avoid > dereferencing null pointer. Why is that fix correct? The only caller (module_frob_arch_sections()) has no way to tell we'd failed. _IF_ ignoring the failure is the right thing to do, the analysis needs to be covered in commit message.