Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1729366rwi; Wed, 19 Oct 2022 14:44:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Fr6FbN//7UJ8B98OvX4O7le7gCp5rAw+FkZdF2JieyX1JgsF8x1E8TvEPiV/AYDcsM5Sq X-Received: by 2002:a05:6a00:843:b0:563:fd4:d73 with SMTP id q3-20020a056a00084300b005630fd40d73mr10650239pfk.47.1666215847023; Wed, 19 Oct 2022 14:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666215847; cv=none; d=google.com; s=arc-20160816; b=HedzUslgwPQ0uws9wF86Av0KOV54P2kzHxIh9EJTWMAljm/vhGgEiq1OI39yY3NXaT xT7AbSK4GcTtBS6yLCB75CtvZpa5e7iCF7mrweRXxtCzgJBktnwa0me3zGGKU54yY6Ga SXdmxB+n/yWqtTFibVikkhOiYXFOx2sFfWlQDEFdDHIy+lQYf4DlGmTsXfuOFJFP+dNi zkoXZmS0/5fJ6X/LMwT0YTpXSh5OpLFhzz9ipX3veYwXV0fmYmzlXCBCWyLIYUtX+VhP 5LZ1BDHfyAzCcO0Yd6yM3p2Wxb2MoevRA/nq7Ji/NLYuiIwfCxZ1DIDLJfZh8BxJEVGj SfDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jnULM9sYd6d4uloxTPeBOBLV/dR4HBprkLdwcmUavtI=; b=A9RobIIu+L35yy5UbtP8Fm613fnXvAc3BUrl9x+j/30q29GTLZ12XeP9+GGbLaj3sa BrsldVn+HomR2z4C1s8ghzPcLpPSIfi9LaJorLFvpU5FcyqL0tPPfFKw2hvpmx3oLQK1 fBzvRn4F2dCLj5pOCjnYUR2RXsZklJX97UX1uCC+jTt6rwp+91USx3NGM42mROMrrsYE caiX/yeQQydbwG2/e7LHozaQyHwRN/OnJLxew6XC6Gb5p1BcifTlxGvrxReW0IPFm6KA sKPtRwjMgCyGxSX1OcqvkLu6ebX0jnE04Wou7FTWT2Ct768nBLx6pIKm9bJQYDMFUlfX wboQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a630f51000000b00450200a1087si18239487pgp.61.2022.10.19.14.43.54; Wed, 19 Oct 2022 14:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231365AbiJSUX1 (ORCPT + 99 others); Wed, 19 Oct 2022 16:23:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbiJSUXT (ORCPT ); Wed, 19 Oct 2022 16:23:19 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 67D0D1C25FF; Wed, 19 Oct 2022 13:23:16 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 29JKFhWg016370; Wed, 19 Oct 2022 15:15:43 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 29JKFgLV016366; Wed, 19 Oct 2022 15:15:42 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 19 Oct 2022 15:15:42 -0500 From: Segher Boessenkool To: Linus Torvalds Cc: Nick Desaulniers , "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-toolchains@vger.kernel.org, Masahiro Yamada , Kees Cook , Andrew Morton , Andy Shevchenko , Greg Kroah-Hartman Subject: Re: [PATCH] kbuild: treat char as always signed Message-ID: <20221019201542.GN25951@gate.crashing.org> References: <20221019162648.3557490-1-Jason@zx2c4.com> <20221019165455.GL25951@gate.crashing.org> <20221019174345.GM25951@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 19, 2022 at 11:56:00AM -0700, Linus Torvalds wrote: > After fixing fortify-string.h to not complain (which was indeed about > strlen() signedness), it turns out a lot were still about 'char', but > not necessarily the functions. > > We use 'unsigned char *' for our dentry data, for example, and then you get > > warning: pointer targets in initialization of ‘const unsigned > char *’ from ‘char *’ differ in signedness > > when you do something like > > QSTR_INIT(NULL_FILE_NAME, > > which is simply doing a regular initializer assignment, and wants to > assign a constant string (in this case the constant string "null") to > that "const unsigned char *name". It cannot see that all users of this are okay with ignoring the difference. > That's certainly another example of "why the heck did the compiler > warn about that thing". Because this is a simple warning. It did exactly what it is supposed to -- you are mixing "char" and "unsigned char" here, and in some cases that matters hugely. > You can literally try to compile this one-liner with gcc: > > const unsigned char *c = "p"; > > and it will complain. What a hugely pointless warning. Yes, there are corner cases like this. Please open a PR if you want this fixed. It is UB to (try to) modify string literals (since they can be shared for example), but still they have type "array of (plain) char". This is historical :-/ Segher