Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1088082imu; Thu, 22 Nov 2018 09:53:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/VH2ZXeMgSDgSJpLv1HOjnY0CC/0a38GyqosxVdAUJj8+KdjDo9MBwNvZJkeC9gGHqYpByo X-Received: by 2002:a63:e302:: with SMTP id f2mr11158091pgh.320.1542909217587; Thu, 22 Nov 2018 09:53:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542909217; cv=none; d=google.com; s=arc-20160816; b=dnnYIlK52r1auqb7F3PYPr7FMi038+rTl7qlD6bw5U1GgelNISzC5slRdKMRAZIVBD USKcYJ/huRvwtOh+tBuWlhIfcnpQaAKFG4gSUnZiXdJ15MducNF6EUvo2XHmgU6X0DZO FksW/RmBYa/FC97HOqXZHtVo21/xnDpN0a53KETCjAktnOi/fn4ghCKE1O3Ja+NMQIn0 B0DdI7SmwCMjjS+seLhg5F/UhABeDgNC+pvPq/FsbPs1/CJfHlscBpA1pPQK4ElRPoYh Qb1C+JzT9IfHuKCUbiZo1EPtcNmqol2Tw6WnzogvlcjSzbvxvB6mipI4N17Sndatlxeq 4Oyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=+5qfuMbSreI8HcVk76Obwuij1w4/Gaf/3P00BJPU4cs=; b=yc/0LxSJSdaKE2KLNyMDn4XyfAM7fTioXsJrgNseLnSeR5ygiPp5NtNNCRkOTsUAoi 8c4CvtY+MVxsKqjEzECAVkz6UcxM7dBsuHBwtvKOGW2sHI6jl4V+auBtmDXOpZquYr/n 5315EZkq1vSUb7HQy/49uw5YKaa1b3j78Aigvy4DWj+I5/AImnUY0vpx5qXSfdjACMQk JlhzAsFAE1h+PXASmqTrSTKB0feAK3unSqrY67cuW2DRixd85t5al6PqNTKsCsgCHuu4 OWIDc5fmQ+PtmDVJYY7n2fbj/IAWwZl8X3/ga61mAVyjAufaxgATLjL/ovQCxohU6nVO e39Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u2ngKWLp; 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 a3-v6si50697185plp.323.2018.11.22.09.53.06; Thu, 22 Nov 2018 09:53:37 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u2ngKWLp; 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 S2389403AbeKVPHa (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); }; /* 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