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 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 184A9EB64DA for ; Fri, 14 Jul 2023 08:02:15 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I7IITyKB943PpWwxiwjiDhNy6Q7rxWYYcny4l7t2cdM=; b=lDcyNdD8OSnCkr vrnIWwTkDM+uB2kc2vVP1WkdqfhQF+88RyiYgawtifbh8tRZPny4fKsTO+t60QGa4VbaGzoL0KtC4 o9zjVu22HvjWesBzTkMAQCGWTk/3dkY2fnZsZJZ3whnAZedpqfVtE/wDTjqdgU3T8FIgA+zJkJ6EY 6yw35AVnng8/M59yVAkELciP7u95K7w5UnW9PwSTCuOMyRDm/a4WWfd2ta4YbTg2A/n7H8e+nZQRj GZOPqA0B3vxCEwz2X+CITqZuH4vVkhaZSzLj7F1HVWMzTEeBh29yzt3yYeRg3s3jb3jIIjW69itNi DZOnPRCLNICgsEnRT9IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qKDkJ-005QsI-0O; Fri, 14 Jul 2023 08:01:47 +0000 Received: from mga02.intel.com ([134.134.136.20]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qKDkG-005Qp8-0V for linux-arm-kernel@lists.infradead.org; Fri, 14 Jul 2023 08:01:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689321704; x=1720857704; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ptuJ9ReMboKqbXzVKP4EvoaiDEiZU+g+UkL2iYfqyiM=; b=GQu4NadsUo3XeYjxpcj3d2gr8YSh6Cnq5cZ6q/brhbqH7iXFonPybdt5 CxDFRYPSrSShFOQNSGwf01or+0qo/E2ugxWF80jjsYOGWvxgYeiSys0+b cdpZlnXQIcpZ/QinqZCjxUW0t++SreEQpy95wKH7XYo3AEqxCBrxFQX2z tIYEhAlQ7JjHHYzDc2esCC4D0Colv84SiEB55xsI2CmKLO4pLcNisAstK rSgU2H80jFql6yxszePre77jYsXv8asOJhbwNqZJWfVk5Kd/5d5QxbviX XEYuv/OnfvvXLsSruLMB9CQSv6Jq1infjBW/8rGRECcgXc0boH5HcOG+S g==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="355355327" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="355355327" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 01:01:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="1052976022" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="1052976022" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga005.fm.intel.com with ESMTP; 14 Jul 2023 01:01:36 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qKDk6-002b7J-2Y; Fri, 14 Jul 2023 11:01:34 +0300 Date: Fri, 14 Jul 2023 11:01:34 +0300 From: Andy Shevchenko To: Yury Norov Cc: Alexander Potapenko , catalin.marinas@arm.com, will@kernel.org, pcc@google.com, andreyknvl@gmail.com, linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, eugenis@google.com Subject: Re: [v2 3/5] arm64: mte: implement CONFIG_ARM64_MTE_COMP Message-ID: References: <20230713125706.2884502-1-glider@google.com> <20230713125706.2884502-4-glider@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230714_010144_234605_51CE2D2A X-CRM114-Status: GOOD ( 13.32 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 13, 2023 at 12:27:15PM -0700, Yury Norov wrote: ... > > > + void *storage = ea0_storage(handle); > > > + int size = ea0_storage_size(handle); > > > + if (!handle || !storage) > > > + return; > > > > You use handle before this check. Haven't you run static analysers? > > This approach is called 'defensive programming' as I learned from > previous iteration. No, this approach called "let compiler optimize the check away". :-) When compiler sees something like TYPE bar = MACRO(foo); // FUNC(foo); if (!foo) blalblabla; the conditional can be eliminated as the optimizer thinks the way "okay, developer already _used_ the foo in some code, it means it can't not be NULL, let's drop a dead code". (Yes, I know what defensive programming means and we actually quite rarely use it in the kernel for the internal APIs) -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel