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: 151716 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp260292ljp; Wed, 21 Nov 2018 20:29:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/VznhjkgdQ3ejhjhQi5Vu1GjAiYzsZ77qsyDW2LZHwwS/eLqxEeDqJBMDefGf/jwN7zKEOO X-Received: by 2002:a63:d949:: with SMTP id e9mr8681086pgj.24.1542860999270; Wed, 21 Nov 2018 20:29:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542860999; cv=none; d=google.com; s=arc-20160816; b=kK1slIp/4soBnuQ0WWuhSosOHIUDuufz2H/Mum8+2QNCQzyV5a31w8ZbpYqJDREI4D uIp1DF09bNzpLIX4vjTTisY9vrFAYrFGaNi8v/B7A1Ckv6QASSFoAzITf+zGd51f4fZR p8FIYQO2OJI57NyJLmeNrZSItFqbwKW5pkV4IV9sQ/jRl6Im2/M3dW+7gy49uOfZZEsZ u8rGOQf98A1h3PVjNQdLqEmDwYOsQNRhOs/pPyUnuuyrDn7O1Ezz5y84lQUAXvhLRhku sHOEKUzkZZPN0r9d865swLxHUKJvme9J0QT+qjn6FbjYfqZChKDa0646fq7sOo/L8wCV TSNQ== 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 3-v6si51396229pfd.146.2018.11.21.20.29.58; Wed, 21 Nov 2018 20:29:59 -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 S2389416AbeKVPHa (ORCPT + 32 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(-) -- 2.7.4 Reviewed-by: Mathieu Malaterre 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; } }