From patchwork Thu Nov 22 04:28:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10693481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FB3E14BD for ; Thu, 22 Nov 2018 04:29:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10E9A2CBFB for ; Thu, 22 Nov 2018 04:29:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03EF02CC05; Thu, 22 Nov 2018 04:29:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C852CBFB for ; Thu, 22 Nov 2018 04:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387638AbeKVPHa (ORCPT ); Thu, 22 Nov 2018 10:07:30 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50047 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730594AbeKVPHa (ORCPT ); Thu, 22 Nov 2018 10:07:30 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAM4SxSQ016430; Thu, 22 Nov 2018 13:29:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAM4SxSQ016430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542860940; bh=+5qfuMbSreI8HcVk76Obwuij1w4/Gaf/3P00BJPU4cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u2ngKWLpQSvocyS5ylHsnIiEKdm+9QxcAD0U9ikQDN3MxYF/eEyEUqWtHznyODWfR JnHuK2rrSDf4Fq9u8b1KBVuCmCeNInD+9LqS9vcI7xY5pcrpm2uJy8qIhHTKPyi0gx MnMvGw3QIB/L27Qv67AM4oz+M1CZkzxvQL+WYsx2saPCVrMjUptpMJAV+x/vuRG87n epHgbtYQSX3Hzs00LpHHGpJys7As3F0l6mdTJd3i7BK4AqHWF9KOtHe96VCyKcN+CZ erlGciGViGIlwfA99rbWy8joA19c8UQpwQ1Lxw1Ixwyt3/qRPf7uFUC5Tdzu6O59pb EsQW+u77EopBw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jessica Yu , Rusty Russell , Mathieu Malaterre , Miguel Ojeda , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] modpost: file2alias: check prototype of handler Date: Thu, 22 Nov 2018 13:28:42 +0900 Message-Id: <1542860922-9730-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542860922-9730-1-git-send-email-yamada.masahiro@socionext.com> References: <1542860922-9730-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use specific prototype instead of an opaque pointer so that the compiler can catch incompatible pointer type. Signed-off-by: Masahiro Yamada Reviewed-by: Mathieu Malaterre --- 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); }; /* 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; } }