Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5593729imu; Mon, 26 Nov 2018 02:42:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/WTi91krZD4G3PHVf+hy9xKCuO/sTX3ffdpESHt5VXPlXc7IjaIrzhQ8BOv+VIhNs7NfvKT X-Received: by 2002:a63:2054:: with SMTP id r20mr24232243pgm.328.1543228926349; Mon, 26 Nov 2018 02:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543228926; cv=none; d=google.com; s=arc-20160816; b=i7zIFunUTvmGoTCk4rj1sC9kDbTGG+8CPdPu/U7VL99dM+QO3Xi0KTNLc9GHmMC6Dk k5PeBK68SWr3Y+JHmXG7U4glYO9xwMpNnoUgy8QLKuUYsF6XTzIKCAEtm1WUBsSZu1qw UVws6eLWl2K2WXb5Tc1Asbpx7wMLK6oGxTJT0MThE9IHq80nn37Vixre3XVAnBrN9CEr qB92gXzVR2Gss7hWYFxZYQoTsZf45or+L4/Vyevmz6YgPIpJLZH1Zs16xcnQ6nanOg4y u8uAyJ+JE8Ck14SAHNf35Ztz0kiwc2h3wIR63XJNlhomQAKlSgBKnbnxfzldTVYaerhz p/5A== 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; bh=FgIERePgpk2uqf/nREl6qjaL77RHDiIugA7bYB9vdt8=; b=cjHYgn38qETZI4FJdU6Hndt58MtIntpZ0FjXkiollDrrXMvr2MNOemp85qyfFOBIEx E8XTurEMNfnBGZb9kO04MEhPoBgEmsnd3qaZZTZDgQ3apMCcG8fyrXXUS/atRRIxhch5 ldZMBb0hQ7N2gh2WvMyhpzZUVXII9yNlx6IDmxhmhQTs/h8vLm2OYGnFKhYaCfiavP8J uamvh/o811/i3c9BVoKcdwrwgJZXlIpekRgW7C+KWhhJP1LoSNRGMiWw/BBX8lTlwaqY DVrJWAII9XK6fAnJs8QQzYGWgGaQojOim+GKj7sPYwbXBaQhFt72Qo2dnhBrTloRcLTD vdCQ== ARC-Authentication-Results: i=1; mx.google.com; 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 f16si28007221pgg.173.2018.11.26.02.41.49; Mon, 26 Nov 2018 02:42:06 -0800 (PST) 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; 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 S1726259AbeKZVeu (ORCPT + 99 others); Mon, 26 Nov 2018 16:34:50 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:43465 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbeKZVeu (ORCPT ); Mon, 26 Nov 2018 16:34:50 -0500 Received: by mail-oi1-f194.google.com with SMTP id u18so15322347oie.10; Mon, 26 Nov 2018 02:41:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FgIERePgpk2uqf/nREl6qjaL77RHDiIugA7bYB9vdt8=; b=WR6h4E1NENnwOfghY1lQ3mtacwiAItzYDoXi1SWKmIDIIy4NaT4/Riv+VlHfAi2AjO qkryIxV0GigYSaZoLK2XWFH4CwoJnQ2SL13qJZnfwd3n0UZu7cIl1K1XqzNz3J4BWrqc otYyvJXQweQkLAO+S06tXhA6J0j8hBVLTtcuwcxqgD2K/zK7KUPmiJGCX0DL8XxAwVMz TkOVGKFrNrqnxoH39E8LIkD2lY30nb55FjLmNYbeV5RIZpyUgb3cjrE6W/FpUgH9wSzn Dcq2QHVI0l6msvpA7petbaJhWogmskc6SKMaZwCxzy2Oq4NbqbmVinuQ9frc65Et7vev Cjaw== X-Gm-Message-State: AA+aEWaRYMaNqZ/WIfcCqGtJC8cU55dLTYwbLicQsACWojgisS6+EULz JCLwi6U8kmBeczdAHd4Wta3pp48+0BpjwXKrW6Y= X-Received: by 2002:aca:100b:: with SMTP id 11mr6037387oiq.303.1543228867924; Mon, 26 Nov 2018 02:41:07 -0800 (PST) MIME-Version: 1.0 References: <1542860922-9730-1-git-send-email-yamada.masahiro@socionext.com> <1542860922-9730-2-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: <1542860922-9730-2-git-send-email-yamada.masahiro@socionext.com> From: Mathieu Malaterre Date: Mon, 26 Nov 2018 11:40:55 +0100 Message-ID: Subject: Re: [PATCH 2/2] modpost: file2alias: check prototype of handler To: Masahiro Yamada Cc: linux-kbuild , Jessica Yu , rusty@rustcorp.com.au, miguel.ojeda.sandonis@gmail.com, Michal Marek , LKML 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 Thu, Nov 22, 2018 at 5:29 AM Masahiro Yamada wrote: > > Use specific prototype instead of an opaque pointer so that the > compiler can catch incompatible pointer type. > > Signed-off-by: Masahiro Yamada > --- > > scripts/mod/file2alias.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c > index 7e4aede..a37af7d 100644 > --- a/scripts/mod/file2alias.c > +++ b/scripts/mod/file2alias.c > @@ -47,7 +47,7 @@ typedef struct { > struct devtable { > const char *device_id; /* name of table, __mod___*_device_table. */ > unsigned long id_size; > - void *function; > + int (*do_entry)(const char *filename, void *symval, char *alias); > }; It makes sense to do this cleanup. Reviewed-by: Mathieu Malaterre > /* Define a variable f that holds the value of field f of struct devid > @@ -1299,12 +1299,11 @@ static bool sym_is(const char *name, unsigned namelen, const char *symbol) > static void do_table(void *symval, unsigned long size, > unsigned long id_size, > const char *device_id, > - void *function, > + int (*do_entry)(const char *filename, void *symval, char *alias), > struct module *mod) > { > unsigned int i; > char alias[500]; > - int (*do_entry)(const char *, void *entry, char *alias) = function; > > device_id_check(mod->name, device_id, size, id_size, symval); > /* Leave last one: it's the terminator. */ > @@ -1420,7 +1419,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, > > if (sym_is(name, namelen, p->device_id)) { > do_table(symval, sym->st_size, p->id_size, > - p->device_id, p->function, mod); > + p->device_id, p->do_entry, mod); > break; > } > } > -- > 2.7.4 >