Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5942806pxb; Mon, 14 Feb 2022 11:16:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRMHEAgxWbeUICzorfQD1q1CJa16Vi2INbWUY9DZqZOYtvPb8dnu3hDEgcdZJeIIY/4HeH X-Received: by 2002:a17:90b:3e89:: with SMTP id rj9mr117242pjb.112.1644866202497; Mon, 14 Feb 2022 11:16:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644866202; cv=none; d=google.com; s=arc-20160816; b=VFm+4PeoZ6td1uryRfl/ucm34x0MkCe4s1dLAXYiehzSozF+l3SZhy0IqqRu0/R6vj fduq4ihh9Vn9Q+dNArxyjGuW5TWlLPu3d19yjW/oFzg28ZEaeUayKhEJy+GQvJWAs8Ri iqZSrWrIuAMYsxnvrXNoyuzteyEtHRMX1I+xpPj8WFWo7QXxtGuZKPSo6z6kvVMWgajY Cfoqklp8b6oIMnDbFSc8dF6FcpGKtp7pscgAOLBq9VjrMHBgV8kdLXzi3uc1Akk0UvnO E6nnGC7b/BVjOUF97Sylw2Zle+Ls2L3rhA8Fvnzz9ldNYb5iXB3tCyjkZEcn3Xbc6SBk tUFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=3lzNn/aD3+mFunDveUiwwqZxWHdLcNfRsBWc/gmgffc=; b=DiwzOBKz2jTsOhECyTN59t3LSCdTczeM0d+K7+HqcG1KQjPg9VpYwGy3qmjOyymf0V lSyD6pC4mXr6iv8Siw+omHK3hyQtcyc9oR9yf7Fvu1V46r24qeboSEfXLTdxlpeuiJFb N5chpqh0xe64AGYys/g4UiHOBG15nJKlN8/QFfLyjqm2nK9WkyvtJufXqu45GpMGsjIt 5Zws/LDDDMno+9rvnLg71pxUct7fT2a6R9RsQgBH5lvBxYuq2NeX++yDIWIfQ/w6AlgQ 9bnkTUW1pUrxfcu1FL4tSsi31pjIUcfRX/buD6RIRopDP2/uq1eMNZXyQ23m1+d91HrW RrYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="Vc/Z2Y4n"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n2si14758484plf.378.2022.02.14.11.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:16:42 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="Vc/Z2Y4n"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D5A432ECF; Mon, 14 Feb 2022 11:08:49 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351413AbiBNL2U (ORCPT + 99 others); Mon, 14 Feb 2022 06:28:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350808AbiBNL2H (ORCPT ); Mon, 14 Feb 2022 06:28:07 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACABC6BDE4; Mon, 14 Feb 2022 03:05:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644836710; bh=/jEI0qa5et1A5fI5AP02quv5hC2xHhHOiKa1B7BmQpY=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=Vc/Z2Y4nQv7sFots98IcQCiTdEZZbwjXU650/1G/9ZssKOFBIbJtOfAj4Kuvbb2aN vVIKnL3zslcEqlqDPeQobhRoZ4ec79wJKwRULO2vYEyevgy9+pQzzQhxeFZqQkfgHi dHU7ZRQrv6jhpfJX4amBI/4saUgt5rfLhY5xtjoc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.20.60] ([92.116.168.11]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M4s0j-1nKNqU3qop-001x2X; Mon, 14 Feb 2022 12:05:09 +0100 Message-ID: Date: Mon, 14 Feb 2022 12:05:00 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH] fat: Use pointer to d_name[0] in put_user() for compat case Content-Language: en-US To: David Laight , OGAWA Hirofumi , "linux-kernel@vger.kernel.org" , Andrew Morton Cc: "linux-parisc@vger.kernel.org" References: <49a26b7a30254d9fb9653c2f815eaa28@AcuMS.aculab.com> <0ecb87dcc4cf42328f1f5a7d6abd08ed@AcuMS.aculab.com> From: Helge Deller In-Reply-To: <0ecb87dcc4cf42328f1f5a7d6abd08ed@AcuMS.aculab.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:AONVuZwsErb6wKyc0u0ZjdTu/g4fjzt+2aSTAeYXCLwWk3OOGTH GPVQdm/wadZSzxXBacz+2n0780srvUVhG2XiN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jx283lktqZqKHfOuEQnXlAN+RzLJYzABSyyEdjWIVW8y5qzJZnmNxEaDSjKt8tEA9uCrkC52 Z092y7NLt1QoyRjIphmCRqP0XkSnFw7GaFa8UBjlKwuwHoVdKDtn5GT6BPEurlsZfDhaGkF1k duKE7HfsvKRo3J26O0/yGQojDpdu3zVzTrN/l6uzDf95piaF/iml8BKpeIIRgo5VgKVmoC21Z g6zsYggJw7U1sU= X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 2/14/22 10:26, David Laight wrote: > From: David Laight >> Sent: 14 February 2022 09:12 >> >> From: Helge Deller >>> Sent: 13 February 2022 22:10 >>> >>> The put_user(val,ptr) macro wants a pointer in the second parameter, b= ut in >>> fat_ioctl_filldir() the d_name field references a whole "array of char= s". >>> Usually the compiler automatically converts it and uses a pointer to t= hat >>> array, but it's more clean to explicitly give the real pointer to wher= e someting >>> is put, which is in this case the first character of the d_name[] arra= y. >> >> That just isn't true. >> >> In C both x->char_array and &x->char_array[0] have the same type >> 'char *'. >> >> The 'bug' is caused by put_user() trying to do: >> __typeof__(ptr) __ptr =3D ptr; >> where __typeof__ is returning char[n] not char *. >> >> I've tried a few things but can't get __typeof__ to >> generate a suitable type for both a simple type and array. > > Actually the issue is that put_user() writes a single variable > and needs a pointer to one. > So changing to: > put_user(0, &array[0]); > is probably fine. Ok. > But the description is all wrong. I agree it can be improved. Would you mind proposing a better description? Helge