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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA0E2C54E67 for ; Thu, 21 Mar 2024 01:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bWS5hMqQqsbPIeh8ctcREa1GwEI3LOA10sInXVn1HBA=; b=YyFWAwaqJYb+o3 kiq0qjKFsTRnrdcE8CH+vbjvR5iR6Ippqko1tW51zljnD0BKj4f/d2iNg9fzTUo7QfEg8jTuYjzz/ G+ZTb2iVKAxj8n/1IE//WpdR2tqoA9bL98tSdIMpkWHBmtsmmPYABj/J725hBbVEIyn8wRCL3ynun Fav9ap/3vhM0ETeg7PUvJ1DB13/4Lf6xbcYoRReswKmTQn3ri87rSpC1AS0o14wva/ZUqH+WPnhrR yp/6WbsHc5/4SknX2T1HvHhMRpU6LGbeJg436Td5jabvOXNCT9VYlU4k7CJhaajfuAjnhbOqnomvf veMJcqY+6u+fevvJb7+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rn78r-00000001Qpz-1S8x; Thu, 21 Mar 2024 01:22:49 +0000 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rn78n-00000001QpZ-3rXz for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 01:22:47 +0000 Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-789fb1f80f5so30441785a.3 for ; Wed, 20 Mar 2024 18:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710984164; x=1711588964; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=A5YLwCRs4Z3FfAPtvjY+K7B2RFwbRTL6v6cmfmmSKhw=; b=D4JtKtT/ncTU8YTMgwkqGNY7PijFHS6Uz4uqFGL88nIULE4QxZbPLSEEUe0DYE1B14 nmcg4yBoh+SJheD0u8jiXiftBLiE5+Yv6G7I0o29XZvMHKXI+Z0EqS3BXUv8kwFILj+m cvU4x26QUj5jjyokb9QxtqDGwU7igStNiCEr3IXN3LWweuN71PiEFhvLtzoifU4RJGe2 RURrWJna/mbzGsOWAiLrKbVuB3cxHDPjZebjLwE7uqK+GqcXmoI2/W4O+FcSs8En9952 zrkm3HlPakHpWhPsvy85ru9l7a+xZLHQeOpcUes5ofw/sgvXN5pEwBZ3b+FCeb3Od7aR 4RhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710984164; x=1711588964; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A5YLwCRs4Z3FfAPtvjY+K7B2RFwbRTL6v6cmfmmSKhw=; b=dPPr/eadIbeI3hEBhflIar9UpcP2MtvkvZPGYYXa9NOwl6KSbD/2noupZep4EAspZG N6O1oPr43t848JuvaqsfeGRi/1dzP01SpAbVBnPkNyIhJg5UU9OM+IeCp5oKS3v0IVwg Mt0XsppE7rZzmx36+9pNfwycSbG5CGSgOs7h5mH4gxZwX7oL3JbuWI8WVX6XS6ldil6K Recs3VSdPPGmndEKtHAJtJ5gBD12F/T4tTqG9Tz7kWFlu0vz+JMMi6gMoh81Vo32xH+R mVpZtEeNRcJ5Xc+w0V2H9ktdEwn3K2T9tt1WLhf1ecxmlTZlx4hM+Az6s9+w6NqI1ysx PWEQ== X-Forwarded-Encrypted: i=1; AJvYcCX+qmEY+Zx5Cbz4y2mP9BHcoDaug0NDmfdnTgHSEYs/49mfPfsTmByAOveaipQji3Nl1nSE55E9DmzKrYJyo3hrrA/4x1a/pnDtZGAtSe1j9qvWdtY= X-Gm-Message-State: AOJu0YyRYtzHiSxoN+Jhw4O7nXXtjIGt+2eJ4NwMhwSDyG0ERhlib1Xl dojXkH2SCeOmvDUfn9nRpMTZb2IXYtlOeVyDjkS9/Sxc2ABO0TUj X-Google-Smtp-Source: AGHT+IH62HfV5ghj3KyPiDSjWcMBc6jT5kTm0aY2+04f5i5pLLuyRe/jujxQlt4C3LkWK5IIDINxxA== X-Received: by 2002:a05:620a:158a:b0:789:eb19:c146 with SMTP id d10-20020a05620a158a00b00789eb19c146mr3696898qkk.67.1710984163915; Wed, 20 Mar 2024 18:22:43 -0700 (PDT) Received: from [10.193.190.170] (mobile-130-126-255-72.near.illinois.edu. [130.126.255.72]) by smtp.gmail.com with ESMTPSA id z27-20020a05620a101b00b007887d30dbb7sm7022601qkj.60.2024.03.20.18.22.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Mar 2024 18:22:43 -0700 (PDT) Message-ID: Date: Wed, 20 Mar 2024 20:22:43 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [arch/arm/mach-mvebu] Question about kzalloc NULL check in i2c_quirk To: Andrew Lunn Cc: "Russell King (Oracle)" , gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, linux-arm-kernel@lists.infradead.org, chenyuan0y@gmail.com References: <1e40d5f4-72ac-40ca-8fb0-34884e7ac549@gmail.com> <2baa9e59-fe81-4c92-b6ca-a86233c5e06d@gmail.com> <69bbda51-f298-494e-bcfc-8e76eacb189d@lunn.ch> Content-Language: en-US From: Zijie Zhao In-Reply-To: <69bbda51-f298-494e-bcfc-8e76eacb189d@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240320_182246_007839_A109204D X-CRM114-Status: GOOD ( 21.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/20/24 8:10 PM, Andrew Lunn wrote: >>> If we are out of memory at this point in the kernel boot, then what are >>> the chances of the kernel getting to the point where it can run >>> userspace? >>> >>> I think that is the essence of Andrew's argument. A failure to allocate >>> memory here means there is a serious problem and the system won't boot >>> _even_ if we add something like: >>> >>> if (!new_compat) >>> continue; >>> >>> to that loop. >>> >> >> >> Hi Andrew and Russell, >> >> Thanks for pointing out the consequence! It makes sense and we will try to >> make our analyzer realize this as well. Thanks again for your time! > > If you can make the analyzer realise this, that would be great. > > If not, feel free to repost this patch, but please rework the commit > message. Point out that checking for NULL is pointless here, the > system is doomed. However, the static analysers cannot determine > that. And it makes sense to silence this pointless warning to stop it > hiding other real warning which could be real issues. "Cannot see the > forest because of the trees". > > Something else to consider. The system is doomed. So maybe call > panic()? > > Andrew Hi Andrew, Thanks for considering help our analyzer. We examined more similar cases and found there are a few other locations where OOM equals dead system, so it would probably be better to improve the analyzer instead of adding more checks. Thanks again for the information and your time! Best, Zijie _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel