Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2437189ybi; Sun, 9 Jun 2019 11:46:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDpdT7EJarasm6+EkYjAeGF1IfD7v9HKuv6WsLErWrFbyS/IIvhlyfd2MIn+WPA56m1RQX X-Received: by 2002:a17:90a:cb12:: with SMTP id z18mr16535185pjt.82.1560106008794; Sun, 09 Jun 2019 11:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560106008; cv=none; d=google.com; s=arc-20160816; b=0XLWMOitOITCNQLwO2Z6jCgp8dX81cxNmc/DbzkqwPjWgJuEMgsjOoSYN3CWKrZu2l wSGpuIKRZAa1D+RVhV8wqhuh28cAghVIcFtFZ7kYiarA/BIMWklWGurfAypAd+FXKmdE b/ArNSuwAu1mcGU3rgTL9NFReY08nnXlUwtj4Xvt+U8RlmOJdvB0Scjz+0YP5lvdtTKo +qi08aHEVVqbwhXWCaT4dRUuJK7GkNRFhzRIpCmvKMa6UGXPHQGy1Yl2o3m+Fr+bi93e gnhRyuDrHJcE1W88qmuuVxhPiKHxuK8Gv8T+sWJNltfB3dC55yofdKOsgjuGdRgjnOhn 20hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=1ySK9wzh5EoMbwrJ8cJodwxCbTXiTLYsNbdKaL1fqtI=; b=J3OPNMzmgwETRJPu3NX9Cup+oq68QVNzocFD0ODeVKahqFB5nRebiRniC1dhXLNyH9 TM2tRH78ZZAwcrJyKGRI427bJy+E0FzbOIk5w1CRB7hDKPU2RWuDuyyRS+8+rT/udliW 4qbwnR/R4Qpx8b6PFIxiJ9ccpuHr/qOY9ODXLZJHGdIY0/NzYnksIoFXQ0ad5cbmkQrb jOLpSBgiOg9liiwOYSQtSQurET43Z0jppI2/I8OMN0gt0FhWemmsJoJWAL4l1tMZHUmA KVJA//e8lEaopigTHMWXLbITk7WR06VuFDKS/lexO8y/ZcRqKBm7vGInPOBb/03EPjJ6 ndGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GZ0tzeWl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si7444923pgp.183.2019.06.09.11.46.32; Sun, 09 Jun 2019 11:46:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GZ0tzeWl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731795AbfFIRUi (ORCPT + 99 others); Sun, 9 Jun 2019 13:20:38 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:20540 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730139AbfFIRUg (ORCPT ); Sun, 9 Jun 2019 13:20:36 -0400 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-06.nifty.com with ESMTP id x59HKQ00009606; Mon, 10 Jun 2019 02:20:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x59HKQ00009606 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1560100827; bh=1ySK9wzh5EoMbwrJ8cJodwxCbTXiTLYsNbdKaL1fqtI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GZ0tzeWlAtCiiyKxspCt0mUF0VDxbXBDzbXup66dIyNRwF29xHu6y3v0d8yGc7Vga BiKpv0OmeIeE0Y66CjkuCM+0BAPuHv1VpltpWJ4TF2i5DXqa1Pe+p7jpFy8qe6vWrH qBKhpSVH6QPz0zbLAxA1LLigJy1pWtotzKV1RzrmcBb7aDdctBwTyz4mnj31ujvRA1 boAROXP/k2UEiz83ZrBY9a5jhxoBe8lagGWMj1GA2PXUweoWWtBmC9iCaWNUWsIsGk qq/MlfQvpU/KtLxzhFdbF+0aQq3JMcHX5lESVHkQegw3Bsmay3vomR7TkWbL8a/zpl M5zJ8+cvafWLg== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id q64so4012902vsd.1; Sun, 09 Jun 2019 10:20:26 -0700 (PDT) X-Gm-Message-State: APjAAAWd/57RmiEDymoUbAULTiOP+z18XgVSkE+NoyC2mDkH8V8D7OvI MMB7n8q/BCIbDLMW9NoM/M5tAN+KMD/oQpARyF0= X-Received: by 2002:a67:cd1a:: with SMTP id u26mr14566333vsl.155.1560100825584; Sun, 09 Jun 2019 10:20:25 -0700 (PDT) MIME-Version: 1.0 References: <20190604111334.22182-1-yamada.masahiro@socionext.com> <8cf48e20064eabdfe150795365e6ca6f36032e9f.camel@perches.com> <20190604134213.GA26263@kroah.com> <20190605051040.GA22760@kroah.com> <20190605071413.779bd821@coco.lan> In-Reply-To: From: Masahiro Yamada Date: Mon, 10 Jun 2019 02:19:49 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: do not use C++ style comments in uapi headers To: Joe Perches Cc: Julia Lawall , Mauro Carvalho Chehab , Greg KH , Arnd Bergmann , Linux Media Mailing List , Thomas Gleixner , Randy Dunlap , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 9, 2019 at 10:40 PM Joe Perches wrote: > > On Sun, 2019-06-09 at 22:08 +0900, Masahiro Yamada wrote: > > On Sun, Jun 9, 2019 at 8:57 PM Joe Perches wrote: > > > On Sun, 2019-06-09 at 16:14 +0900, Masahiro Yamada wrote: > > > > Hi Joe, > > > > > > > > On Thu, Jun 6, 2019 at 2:06 AM Joe Perches wrote: > > > > > Perhaps a checkpatch change too: > > > > > > > > > > The first block updates unsigned only bitfields > > > > > The second tests uapi definitions and suggests "__ > > > > > > > Good. > > > > > > > > In addition, > > > > > > > > "warn if __u8, __u16, __u32, __u64 are used outside of uapi/" > > > > > > > > Lots of kernel-space headers use __u{8,16,32,64} instead of u{8,16,32,64} > > > > just because developers often miss to understand when to use > > > > the underscore-prefixed types. > > > > > > The problem there is that checkpatch can't know if the > > > __ being used is for an actual uapi use or not. > > > > > > coccinelle could be much better at that. > > > > Why? > > > Perhaps it's (somewhat) bad form to have a __uapi type in a > structure, include that structure in a driver for something > like a copy_to/from_user, and map the __ to a non > underscore prefixed Linus Torvalds wrote 'sparse' to check this. Any attempt to distinguish the address-space by the presence of double-underscore-prefixes is pointless. This is already checked by __kernel / __user. It is absolutely correct to assign __u32 to u32, and vice versa. If you think the following patch is wrong, please tell me why: diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 748ac489ef7e..24c1b73d9fbd 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -1132,7 +1132,7 @@ static struct binder_node *binder_init_node_ilocked( struct binder_node *node; binder_uintptr_t ptr = fp ? fp->binder : 0; binder_uintptr_t cookie = fp ? fp->cookie : 0; - __u32 flags = fp ? fp->flags : 0; + u32 flags = fp ? fp->flags : 0; assert_spin_locked(&proc->inner_lock); @@ -4918,7 +4918,7 @@ static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, { struct binder_node *node; struct binder_context *context = proc->context; - __u32 handle = info->handle; + u32 handle = info->handle; if (info->strong_count || info->weak_count || info->reserved1 || info->reserved2 || info->reserved3) { > > For instance > > struct flat_binder_object in drivers/android/binder.c > > How is checkpatch supposed to know that __u32 flags is > inappropriate? > > -- Best Regards Masahiro Yamada