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 C5490C433FE for ; Wed, 2 Feb 2022 16:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345801AbiBBQRh (ORCPT ); Wed, 2 Feb 2022 11:17:37 -0500 Received: from mga05.intel.com ([192.55.52.43]:12098 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbiBBQRe (ORCPT ); Wed, 2 Feb 2022 11:17:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643818654; x=1675354654; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=DBfsC8a66ExyypbPhJbhCI57mnu5iWgHbE6gVmzyI2I=; b=YVMf+l1+ZKlvAuNqSqpMqmK2q82XtSwzBOO/3r70+NvFOox/UnJQVUi0 rCd5MKXhkLnqyU86xXPqW5SvSYDubPmUqvhPpHXZ+pazqZMEN/XNmraWu sBFoyTn6vkICS19EntOqG8Rsx/F4fffzgU+sZtPWDzd6r8N8/yhWAN+Ud laO70xLGSd0UpO0NpMSjqUyzH5lfyvuQ2t1XqSs56fw5zuj97SoHXRZWo doJzrBKBhp5SgZy0GwMeWdPSWogy/SPRJ+bSh9E4urUFZfuZ3ObdJ3dBT AY1nL3MoWU+m9jetMbS7Mgyi7mWfuUJ3Oejoi3kB9dyrpS+0WqpSRuQNq w==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="334311447" X-IronPort-AV: E=Sophos;i="5.88,337,1635231600"; d="scan'208";a="334311447" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 08:17:34 -0800 X-IronPort-AV: E=Sophos;i="5.88,337,1635231600"; d="scan'208";a="769324845" Received: from smile.fi.intel.com ([10.237.72.61]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 08:17:31 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nFIJ2-0008eW-RG; Wed, 02 Feb 2022 18:16:28 +0200 Date: Wed, 2 Feb 2022 18:16:28 +0200 From: Andy Shevchenko To: Guenter Roeck Cc: Kees Cook , Geert Uytterhoeven , Peter Rosin , Andy Shevchenko , Matteo Croce , Nathan Chancellor , Nick Desaulniers , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] lib/test_string.c: Add test for strlen() Message-ID: References: <20220130183653.491292-1-keescook@chromium.org> <20220202160149.GA2322037@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220202160149.GA2322037@roeck-us.net> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 02, 2022 at 08:01:49AM -0800, Guenter Roeck wrote: > On Sun, Jan 30, 2022 at 10:36:53AM -0800, Kees Cook wrote: ... > > +static const int strlen_ce = strlen("tada, a constant expression"); > > This results in: > > lib/test_string.c:188:30: error: initializer element is not constant > 188 | static const int strlen_ce = strlen("tada, a constant expression"); > > for several of my tests. I don't think you can mandate that a compiler > implements this. With -O2 probably one can, otherwise I agree. -- With Best Regards, Andy Shevchenko