{"id":808203,"url":"http://patchwork.ozlabs.org/api/patches/808203/?format=json","web_url":"http://patchwork.ozlabs.org/project/lede/patch/1504175965-22591-1-git-send-email-dedeckeh@gmail.com/","project":{"id":54,"url":"http://patchwork.ozlabs.org/api/projects/54/?format=json","name":"LEDE development","link_name":"lede","list_id":"lede-dev.lists.infradead.org","list_email":"lede-dev@lists.infradead.org","web_url":"http://lede-project.org/","scm_url":"","webscm_url":"http://git.lede-project.org/","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504175965-22591-1-git-send-email-dedeckeh@gmail.com>","list_archive_url":null,"date":"2017-08-31T10:39:25","name":"[LEDE-DEV,ubox,v2] kmodloader: lift restriction on module alias info","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"a243de82a44b83528fe20e0d60fe0b55ad45aedb","submitter":{"id":65331,"url":"http://patchwork.ozlabs.org/api/people/65331/?format=json","name":"Hans Dedecker","email":"dedeckeh@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/lede/patch/1504175965-22591-1-git-send-email-dedeckeh@gmail.com/mbox/","series":[{"id":800,"url":"http://patchwork.ozlabs.org/api/series/800/?format=json","web_url":"http://patchwork.ozlabs.org/project/lede/list/?series=800","date":"2017-08-31T10:39:25","name":"[LEDE-DEV,ubox,v2] kmodloader: lift restriction on module alias info","version":2,"mbox":"http://patchwork.ozlabs.org/series/800/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808203/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808203/checks/","tags":{},"related":[],"headers":{"Return-Path":"<lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"IgBiD7XY\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Ym06fPSt\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjfm81w7Dz9sQl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 21:10:00 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnNLy-0002ye-6L; Thu, 31 Aug 2017 11:09:42 +0000","from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnMt5-0005TY-Er\n\tfor lede-dev@lists.infradead.org; Thu, 31 Aug 2017 10:39:57 +0000","by mail-wr0-x242.google.com with SMTP id k94so218021wrc.0\n\tfor <lede-dev@lists.infradead.org>;\n\tThu, 31 Aug 2017 03:39:31 -0700 (PDT)","from cplx43.eu.thmulti.com ([141.11.62.7])\n\tby smtp.gmail.com with ESMTPSA id\n\tm136sm3604424wmb.23.2017.08.31.03.39.28\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 31 Aug 2017 03:39:28 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:\n\tDate:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:\n\tResent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:\n\tList-Owner; bh=2SiD4q/4nWd5TQ6+e8xSnAutvdks4QlGWf8s08emWJs=;\n\tb=IgBiD7XY7G56EA\n\tJrYF2mpdyzBdcn2sqsSUg/ENzI4SHZZfh7YsgpoC8sjo/Akmb5uyl+TMMNDsF3VNcd9z0ys2kRCvp\n\t0a1viYzxXnOsyZ/e8i/WXpjRzlGRNTGCVkbmsWKBYPlVRjeQKKoezmn8Fj3ifmwjMzuXa4QiDejmy\n\tDQKN+ffy0mzgCRV6bc0yZiMSQo7L8VnHPSKPpm6uGcgbM0btS30wogPACuBE5+Ykgmpd5/UDtXBvV\n\tv9x+xLzRvLUg0jJ0B84E9UsrQ/16DyMMug3N+s7acLYzg3qIWj2DFI94lpp8hscrAxCB7NUP4Rm6P\n\teP+vR6WX4l4dbVI/R3Wg==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=HxN7ICDPg+v7vbaBFzy4VYoYN77sW12+ipV77L3vqM0=;\n\tb=Ym06fPStV7cVW9pYm+N/Cd8yG78nMV5RH25h/RQVLiFI9jmSN4ChIvAaY77f8mxAoh\n\t60NVpwRo9BVd3MfQvop7ofqN7p/mtuVrVOT+nQ8829yoaLUrmYdtqdAP30XHnlQph7+G\n\tKlDY0YstoxdDx5YIxPpQ0/LZzVJDvc/61eSflZW96+SlsO5PcaLoryBSXBR49fzTSzhf\n\t2huDLspPgTF9VufRrePRVGdIxTnmu3//CocGzi4AJ8SPY5spIHUAmprgLwwVBL3k0fm4\n\tb+5auQil6cFfg7MWwtqXfWa7HDHvcENZTps119PxzDTZd+WLhOp2yo/yBKxQgvmn9FWE\n\t4Mfw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=HxN7ICDPg+v7vbaBFzy4VYoYN77sW12+ipV77L3vqM0=;\n\tb=Zn7bBy+cct+LJVw8jHHdJCi/KQYw0ODQ/7xz01GF3UXcgwKCG1rSldgYbdzS+iUDAA\n\t6mLYSpOoHd6PcTG57opHe+y5TdtvLpY8EtDeNgwRyMfpUbOLRJRgH6XPNatmkwF58Kt/\n\tj28Y+XUXg2OAeoxcjUyaeFkKl1/7kKjuQwvlq4gyG75IpjE6yGl3cLz8Mer+Rlwc1wx/\n\tZxvFR0tnpIV84WRzGBDYhiP/SLpEgDPAqwCXmInXg4005murOy37P14tv3bWTYBzJbNV\n\tB93HgL1YwjdaInQswggfUMAqy1yKFYDozQmRjQSFTsJ2iggYzKKMC+3piKmn+mVY0rTs\n\teZ2Q==","X-Gm-Message-State":"AHYfb5h0CL/nzu4QzRVPgzOmp+Be9M3bqafUeyjaWMYn4IAmAz1RyYXl\n\tShcSvMAF2h4I3w==","X-Google-Smtp-Source":"ADKCNb4DkP38wN1JclMMcjboq3kZMi04goCdjP5b5STe8nkL61qMZiNd7eKNP0MAZOzsFRQ2MqsvYg==","X-Received":"by 10.223.164.19 with SMTP id d19mr2747302wra.302.1504175969554; \n\tThu, 31 Aug 2017 03:39:29 -0700 (PDT)","From":"Hans Dedecker <dedeckeh@gmail.com>","To":"blogic@phrozen.org, lede-dev@lists.infradead.org, yszhou4tech@gmail.com","Date":"Thu, 31 Aug 2017 12:39:25 +0200","Message-Id":"<1504175965-22591-1-git-send-email-dedeckeh@gmail.com>","X-Mailer":"git-send-email 1.9.1","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170831_033952_087474_5F6E1B3C ","X-CRM114-Status":"GOOD (  12.34  )","X-Spam-Score":"-2.0 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2a00:1450:400c:c0c:0:0:0:242 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (dedeckeh[at]gmail.com)\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","Subject":"[LEDE-DEV] [PATCH ubox v2] kmodloader: lift restriction on module\n\talias info","X-BeenThere":"lede-dev@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<lede-dev.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/lede-dev/>","List-Post":"<mailto:lede-dev@lists.infradead.org>","List-Help":"<mailto:lede-dev-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=subscribe>","Cc":"Hans Dedecker <dedeckeh@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"Lede-dev\" <lede-dev-bounces@lists.infradead.org>","Errors-To":"lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"kmodloader has a restriction of storing only 32 aliases for a given\nmodule; as modules can have easily more than 32 aliases let's remove\nthe restriction by using a dynamic allocation mechanism when retrieving\nthe aliases.\nWhile at it also check the get_module_info return value setting an error\ncode in case NULL is returned.\n\nSigned-off-by: Hans Dedecker <dedeckeh@gmail.com>\n---\nv2: Check get_module_info return value setting an error code in\nscan_module_folder in case NULL is returned\n\n kmodloader.c | 24 ++++++++++++++----------\n 1 file changed, 14 insertions(+), 10 deletions(-)","diff":"diff --git a/kmodloader.c b/kmodloader.c\nindex 3dc7665..a7fc4f4 100644\n--- a/kmodloader.c\n+++ b/kmodloader.c\n@@ -340,7 +340,7 @@ static struct module* get_module_info(const char *module, const char *name)\n \tint fd = open(module, O_RDONLY);\n \tunsigned int offset, size;\n \tchar *map = MAP_FAILED, *strings, *dep = NULL;\n-\tconst char *aliases[32] = { 0 };\n+\tconst char **aliases = NULL;\n \tint naliases = 0;\n \tstruct module *m = NULL;\n \tstruct stat s;\n@@ -383,11 +383,11 @@ static struct module* get_module_info(const char *module, const char *name)\n \t\tif (!strncmp(strings, \"depends=\", len + 1))\n \t\t\tdep = sep;\n \t\telse if (!strncmp(strings, \"alias=\", len + 1)) {\n-\t\t\tif (naliases < ARRAY_SIZE(aliases))\n-\t\t\t\taliases[naliases++] = sep;\n-\t\t\telse\n-\t\t\t\tULOG_WARN(\"module %s has more than %d aliases: truncated\",\n-\t\t\t\t\t\tname, ARRAY_SIZE(aliases));\n+\t\t\taliases = realloc(aliases, sizeof(sep) * (naliases + 1));\n+\t\t\tif (!aliases)\n+\t\t\t\tgoto out;\n+\n+\t\t\taliases[naliases++] = sep;\n \t\t}\n \t\tstrings = &sep[strlen(sep)];\n \t}\n@@ -404,6 +404,8 @@ out:\n \tif (fd >= 0)\n \t\tclose(fd);\n \n+\tfree(aliases);\n+\n \treturn m;\n }\n \n@@ -413,7 +415,7 @@ static int scan_module_folder(const char *dir)\n \tstruct utsname ver;\n \tchar *path;\n \tglob_t gl;\n-\tint j;\n+\tint j, rv = 0;\n \n \tuname(&ver);\n \tpath = alloca(strlen(dir) + sizeof(\"*.ko\") + 1);\n@@ -430,13 +432,15 @@ static int scan_module_folder(const char *dir)\n \t\t\tcontinue;\n \n \t\tm = find_module(name);\n-\t\tif (!m)\n-\t\t\tget_module_info(gl.gl_pathv[j], name);\n+\t\tif (!m) {\n+\t\t\tif (!get_module_info(gl.gl_pathv[j], name))\n+\t\t\t\trv |= -1;\n+\t\t}\n \t}\n \n \tglobfree(&gl);\n \n-\treturn 0;\n+\treturn rv;\n }\n \n static int scan_module_folders(void)\n","prefixes":["LEDE-DEV","ubox","v2"]}