Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp293551imj; Thu, 7 Feb 2019 04:31:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IbiwSCIJ1la2NNJZ/Tp8U4AEeGeloQ6GEcCF6mjIiPYKpePQfnlChLeI9roLqzeCMSAvjgm X-Received: by 2002:a63:2f86:: with SMTP id v128mr14174008pgv.407.1549542705821; Thu, 07 Feb 2019 04:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549542705; cv=none; d=google.com; s=arc-20160816; b=hKtcfGrmCRXayYxxP1k06sxRTYBJInftLO+u4bXWNq1H0+RFctATVeBHJa5LUuyZw5 We924a+yx6b31TY/mbN7th0xLffwjWsUx6QAoYFzolgP8KklFFDlGNtAOUbeW0wa8fa3 ZJRNxPVyQDI+RxSHpVQ2+qXHFZi4QjLD0+yvUSKcP/m5MdGG/ZqMQs+TAWEHvfy3YEUh eZej/8Rw6VsGof+kXjPlIJxem26pdgw/kijBwNmnOnfARt7sJwOZUZxW5f0oVBJlJ1cR SxqxcYbgu78S1N/GLMtTMcdxzASKH4mBFJbw8Ee6YfG+XS/P3ssiJCVHPEt1RamtQWaN r8eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OAiXN7LlugdwkwgPHPSYF7l13efDAqbPb+cBUigNQ7c=; b=U1jQAlg7p8LDeKJhePzw1sMxchSubvWExoJB4Ro8DX2sX5a7gH6psUEeA59CvugfTx G7iyUWjwIAs/pfc+CqAYZlirC+chCPPyNXMav6Sere+I+NOArx9RxaKvO2NxGzWr4Jsk ap/PQngt4FtoRNlyISaMUg4gWqXAqJ9r3jkmNBFHVAcHGQi4/PT/TNQkT9BWlx389dZN aZ2yu6Nbm+tNpWJzd25GZ3PDX4NzUgBsCNKKZljdBISYa4GRQyx15kquYd2WsjWuWA4x W8/dGgMbEl3tLC4tMNmX0mPamNzgpz9WhXx+3EMisCIw7RR2t5502SVdi20WHNSw9dsU jt2A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mok.nu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si8312325pgl.507.2019.02.07.04.31.29; Thu, 07 Feb 2019 04:31:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mok.nu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbfBGMar (ORCPT + 99 others); Thu, 7 Feb 2019 07:30:47 -0500 Received: from proxy01.fsdata.se ([89.221.252.211]:41136 "EHLO mail-gw01.fsdata.se" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726769AbfBGMar (ORCPT ); Thu, 7 Feb 2019 07:30:47 -0500 Received: from localhost (94.234.45.123) by DAG01.HMC.local (192.168.46.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 7 Feb 2019 13:30:41 +0100 From: Mattias Jacobsson <2pi@mok.nu> To: , CC: <2pi@mok.nu>, , Subject: [PATCH] modpost: file2alias: define size of alias Date: Thu, 7 Feb 2019 13:30:22 +0100 Message-ID: <20190207123022.7961-1-2pi@mok.nu> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [94.234.45.123] X-ClientProxiedBy: PROXY01.HMC.local (192.168.46.51) To DAG01.HMC.local (192.168.46.11) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The size of the variable alias provided to do_entry functions are currently not readily available. Thus hindering do_entry functions to perform bounds checking. Define the macro ALIAS_SIZE containing the size of the variable alias. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> --- Related discussion: [1] and [2] (around the first answer line) [1]: https://lore.kernel.org/lkml/20190128150909.4r3tje5l34u5t2xs@mok.nu/ [2]: https://lore.kernel.org/lkml/CAHp75VcLizx+jtMrbc3Ev-HcJVEjH2naFC0sj=7fX5nZSCGc8Q@mail.gmail.com/ --- scripts/mod/file2alias.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index a37af7d71973..afe22af20d7d 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -50,6 +50,9 @@ struct devtable { int (*do_entry)(const char *filename, void *symval, char *alias); }; +/* Size of alias provided to do_entry functions */ +#define ALIAS_SIZE 500 + /* Define a variable f that holds the value of field f of struct devid * based at address m. */ @@ -1303,7 +1306,7 @@ static void do_table(void *symval, unsigned long size, struct module *mod) { unsigned int i; - char alias[500]; + char alias[ALIAS_SIZE]; device_id_check(mod->name, device_id, size, id_size, symval); /* Leave last one: it's the terminator. */ -- 2.20.1