[{"id":1760189,"web_url":"http://patchwork.ozlabs.org/comment/1760189/","msgid":"<CAECwjAi=YLG3A1jhNtRZM6CGjgA9FBZWFX5ASFM8dydEnG5ncQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-30T14:09:37","subject":"Re: [LEDE-DEV] [PATCH ubox 2/3] kmodloader: lift restriction on\n\tmodule alias info","submitter":{"id":65295,"url":"http://patchwork.ozlabs.org/api/people/65295/","name":"Yousong Zhou","email":"yszhou4tech@gmail.com"},"content":"On 30 August 2017 at 21:24, Hans Dedecker <dedeckeh@gmail.com> wrote:\n> kmodloader has a restriction of storing only 32 aliases for a given\n> module; as modules can have easily more than 32 aliases let's remove\n> the restriction by using a dynamic allocation mechanism when retrieving\n> the aliases.\n>\n> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>\n> ---\n>  kmodloader.c | 14 ++++++++------\n>  1 file changed, 8 insertions(+), 6 deletions(-)\n>\n> diff --git a/kmodloader.c b/kmodloader.c\n> index a4d492d..2ece0c2 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>         int fd = open(module, O_RDONLY);\n>         unsigned int offset, size;\n>         char *map = MAP_FAILED, *strings, *dep = NULL;\n> -       const char *aliases[32] = { 0 };\n> +       const char **aliases = NULL;\n>         int naliases = 0;\n>         struct module *m = NULL;\n>         struct stat s;\n> @@ -383,11 +383,11 @@ static struct module* get_module_info(const char *module, const char *name)\n>                 if (!strncmp(strings, \"depends=\", len + 1))\n>                         dep = sep;\n>                 else if (!strncmp(strings, \"alias=\", len + 1)) {\n> -                       if (naliases < ARRAY_SIZE(aliases))\n> -                               aliases[naliases++] = sep;\n> -                       else\n> -                               ULOG_WARN(\"module %s has more than %d aliases: truncated\",\n> -                                               name, ARRAY_SIZE(aliases));\n> +                       aliases = realloc(aliases, sizeof(sep) * (naliases + 1));\n> +                       if (!aliases)\n> +                               goto out;\n\nWe should probably just die(\"out of memory\") in this case.  Other than\nthat, ACK from me ;)\n\nRegards,\n                yousong\n\n> +\n> +                       aliases[naliases++] = sep;\n>                 }\n>                 strings = &sep[strlen(sep)];\n>         }\n> @@ -404,6 +404,8 @@ out:\n>         if (fd >= 0)\n>                 close(fd);\n>\n> +       free(aliases);\n> +\n>         return m;\n>  }\n>\n> --\n> 1.9.1\n>","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=\"X/NpMMed\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"laPt1SQ/\"; 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 3xj6r54tdXz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 00:11:33 +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 1dn3iA-0005t0-0N; Wed, 30 Aug 2017 14:11:18 +0000","from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dn3hE-0003O7-4j\n\tfor lede-dev@lists.infradead.org; Wed, 30 Aug 2017 14:10:27 +0000","by mail-yw0-x242.google.com with SMTP id s143so4107539ywg.4\n\tfor <lede-dev@lists.infradead.org>;\n\tWed, 30 Aug 2017 07:09:59 -0700 (PDT)","by 10.37.171.116 with HTTP; Wed, 30 Aug 2017 07:09:37 -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:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Subject:To:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=JP60729twjfYBlI0CAV/ecjiMZz2daW3HcTlu50xmcg=;\n\tb=X/NpMMed2WAkzM\n\tJOVwRfjvhkE519oNc4HJ/ME3Fvsrq9dHn4MmxTOGp2g1pU6jX2CFqNipQ1K2+Gp0uQ1gn3oSi/Tql\n\t4nRDx/WfhkqlTTJOyGS0R+PtmIqoRcttn6pOOXxAXJzq6sghIuOgX3RfIF2Tk0X882tAKxQJWsr8c\n\tLe5K7Lb6+q0tQRFtudJqaS9FZvwO1+BmWUfhguWiX81U8ONS3029g6ZzaDD5Jso+Em3sFYFUQoKhA\n\t2u/xO6TgS51NPmDanJMTYtpdhabF86V+hNq/dCuPrx3q/peG1njypWhfZXLN0PSTj3hxD4aY6AFi1\n\tCiztebIMHeUNOfkUMoBg==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=f6k4rr/G4dtHGHSkO1G8TL3R5kPFoYwu0Edx55tmyy4=;\n\tb=laPt1SQ/EFAHW8GU/2gQXoklaK0ij77KKrkJSH1L7lkicMDQjEhS/xO+lwY2TOJjlM\n\twXlLhjrQwj5PqHBHDj3tUHYgB8HBmkcrWgqKGBNNSGCajCEErruXz459l5SSA6Jl0cyE\n\t+w2MFnmenuldcRNx8Ib8l7UAmZ2PNECn8Lg4KGhRQ3Zl3kKQuCYi55f4aY9gdDaYaDS2\n\taJ29CekgsVWAMU5ZpJk5LL3svt2orQfOuhUsXq1iUr8KzMrn17ofhklhe3+Gus7o5SZ5\n\tIrp6t2/gSYN9se/6owySx69vC+89/DbQIjNoEqdKD79oDMiYJSp8lT5DGCtxHG4NAaFp\n\tQMNQ=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=f6k4rr/G4dtHGHSkO1G8TL3R5kPFoYwu0Edx55tmyy4=;\n\tb=Za39DFHcnSNhj7M9F1i4D63OaM6g+nn+VC7YL21yND27sa574yiLweMyUJfx24qY/E\n\tDFSbQhxrpYbTBG8depNtAnEEpvEAklvVN1wjbHaJ98YoUFrFi8BiZsV4Dl+Rht1sp/6o\n\tVwNPhRN/UoU2V2Pptv+BckV6kBtamcPu76HN+K3Y0G7wHb04DjSSm0kb9KHKFGjv5NwY\n\t8qusJURkSw/2ZWkwrBo5zIpJnCNM1vUu/f8zJrHpBZuUI4Xos6Bm8JjSbLklHoB5KQGG\n\t6vCRvYn5kscjVvWYOp2BxxVxKTCruqlJtXN/4DoD57h9dU/SKd1G9vMPUkmsSm72UDSk\n\tM2+A==","X-Gm-Message-State":"AHYfb5gJUR24f7+gM6cYWTsP4PgyoUGF0T/ru/qRe1NH2PlWq7jM6aYA\n\tgs862lqjPlV8TCuZsgtwByBFiPM7Aw==","X-Received":"by 10.37.78.133 with SMTP id c127mr1277934ybb.291.1504102198132; \n\tWed, 30 Aug 2017 07:09:58 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1504099491-25402-1-git-send-email-dedeckeh@gmail.com>","References":"<1504099491-25402-1-git-send-email-dedeckeh@gmail.com>","From":"Yousong Zhou <yszhou4tech@gmail.com>","Date":"Wed, 30 Aug 2017 22:09:37 +0800","Message-ID":"<CAECwjAi=YLG3A1jhNtRZM6CGjgA9FBZWFX5ASFM8dydEnG5ncQ@mail.gmail.com>","To":"Hans Dedecker <dedeckeh@gmail.com>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170830_071020_753424_CE721687 ","X-CRM114-Status":"GOOD (  12.89  )","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 [2607:f8b0:4002:c05: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 (yszhou4tech[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":"Re: [LEDE-DEV] [PATCH ubox 2/3] kmodloader: lift restriction on\n\tmodule alias 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":"LEDE Development List <lede-dev@lists.infradead.org>,\n\tJohn Crispin <john@phrozen.org>","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"}},{"id":1760751,"web_url":"http://patchwork.ozlabs.org/comment/1760751/","msgid":"<CAJLcKsFLqA3Oq5b5p8afk6=iAOLXyncnCdR+dME78F3nSRgeFQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-31T08:44:20","subject":"Re: [LEDE-DEV] [PATCH ubox 2/3] kmodloader: lift restriction on\n\tmodule alias info","submitter":{"id":65331,"url":"http://patchwork.ozlabs.org/api/people/65331/","name":"Hans Dedecker","email":"dedeckeh@gmail.com"},"content":"On Wed, Aug 30, 2017 at 4:09 PM, Yousong Zhou <yszhou4tech@gmail.com> wrote:\n> On 30 August 2017 at 21:24, Hans Dedecker <dedeckeh@gmail.com> wrote:\n>> kmodloader has a restriction of storing only 32 aliases for a given\n>> module; as modules can have easily more than 32 aliases let's remove\n>> the restriction by using a dynamic allocation mechanism when retrieving\n>> the aliases.\n>>\n>> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>\n>> ---\n>>  kmodloader.c | 14 ++++++++------\n>>  1 file changed, 8 insertions(+), 6 deletions(-)\n>>\n>> diff --git a/kmodloader.c b/kmodloader.c\n>> index a4d492d..2ece0c2 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>>         int fd = open(module, O_RDONLY);\n>>         unsigned int offset, size;\n>>         char *map = MAP_FAILED, *strings, *dep = NULL;\n>> -       const char *aliases[32] = { 0 };\n>> +       const char **aliases = NULL;\n>>         int naliases = 0;\n>>         struct module *m = NULL;\n>>         struct stat s;\n>> @@ -383,11 +383,11 @@ static struct module* get_module_info(const char *module, const char *name)\n>>                 if (!strncmp(strings, \"depends=\", len + 1))\n>>                         dep = sep;\n>>                 else if (!strncmp(strings, \"alias=\", len + 1)) {\n>> -                       if (naliases < ARRAY_SIZE(aliases))\n>> -                               aliases[naliases++] = sep;\n>> -                       else\n>> -                               ULOG_WARN(\"module %s has more than %d aliases: truncated\",\n>> -                                               name, ARRAY_SIZE(aliases));\n>> +                       aliases = realloc(aliases, sizeof(sep) * (naliases + 1));\n>> +                       if (!aliases)\n>> +                               goto out;\n>\n> We should probably just die(\"out of memory\") in this case.  Other than\n> that, ACK from me ;)\nMy aim was to keep the code consistent when doing OOM error handling\nas another realloc failure also returned an error code which is\nhandled by the calling function.\nHaving said that I notice the get_module_info return code is not\nhandled by scan_module_folder; would it be ok for you if in the\nfollow-up patch the error code is handled instead of just die ?\n\nHans\n>\n> Regards,\n>                 yousong\n>\n>> +\n>> +                       aliases[naliases++] = sep;\n>>                 }\n>>                 strings = &sep[strlen(sep)];\n>>         }\n>> @@ -404,6 +404,8 @@ out:\n>>         if (fd >= 0)\n>>                 close(fd);\n>>\n>> +       free(aliases);\n>> +\n>>         return m;\n>>  }\n>>\n>> --\n>> 1.9.1\n>>","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=\"mqZ6BL86\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ZyRu5B7r\"; 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 3xjbXq2PLfz9t2M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 18:44:59 +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 1dnL5i-0002QI-9z; Thu, 31 Aug 2017 08:44:46 +0000","from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnL5e-0002PZ-FJ\n\tfor lede-dev@lists.infradead.org; Thu, 31 Aug 2017 08:44:44 +0000","by mail-pf0-x244.google.com with SMTP id r187so25228pfr.5\n\tfor <lede-dev@lists.infradead.org>;\n\tThu, 31 Aug 2017 01:44:21 -0700 (PDT)","by 10.100.154.66 with HTTP; Thu, 31 Aug 2017 01:44:20 -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:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Subject:To:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=fUVfk/CSlc5nwiijE14N0N0ddUR+MZ4PGOpNUf5Or6o=;\n\tb=mqZ6BL86MEQ5uB\n\tfQKtttRgbwC32nKmA/CEs85G8YP1pNjHaDm/aBSOnwdR4JebtbueFnWDilPmyiJpVbLT2v1KsmQx/\n\tD0JEqmduwq47jDO8m8ZNkOjYtaUY99LKXTXCkZadiHK8J2ireAx33/bBRWanZC24DfZ51R95G4oKq\n\tQxW0tLn2NhFxCLRwlVQKPVt6hU6mgoB8ZUOmKXbOyuE6vFp54FdKYTNbshEB+m3KEoKwvG2P9pP/3\n\twroVqoWYgsZLfg+A+iMPEU8YCkpDa+f/QfQ2MxWuwK5CCcJif0WYs/538wJPH1kaV0TCg4Bp0jjpv\n\t/YYFUGyxCPFVRSvm76vw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=/iten2r+Cwi9Xa1u6ZzAgmyrR3rXnPdt1+gza/bwrUw=;\n\tb=ZyRu5B7rOZBeA2YdQWoJQroDkfumI/MUTvmcxQzvlEVah24FEVbAhuZZx2UsSSFwyO\n\tWguWbgOxvNaNLHDyE4zT1mhW/pOlxHcKxGF1or4urlcZtG8sQJVpZS0KMDYJdMGUdju2\n\teZRC0BDb1+lhgH0lgvlnciGtiIq03mB6AZbqPa/rxtbuR9YG8OTnfYNMC3HJUMe2Vxf4\n\teMeNt50uoSvwQbGGixPo5eHTsO3bn/fa35lDVSNLzlx9pTi+og3UoBRUl312vrrD4ejy\n\taNgLn/EUCCistFABF9bcxMYcVNoQ2R415tyDOQ3jtirP66W6buT0QTT2+R0djU8lxLjM\n\t+hRQ=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=/iten2r+Cwi9Xa1u6ZzAgmyrR3rXnPdt1+gza/bwrUw=;\n\tb=MrjdFiNEVfDyoTw6ivFqnr0M5qh0XsiXrmoZUNqrPBituj9obxleTgkt9H99rlWLFb\n\tMLvTrI8v6n2+g1YVvnx3fjxjEkpcD4fUaSFmR+0aLoOu7qVN8gZUVDqZozTlFUG2auqz\n\tqUtyY308VQ+iwye2ZHTLTnJFMN8fZWew7YVHJ6la9tlxLcAJUvjeFluS+/j0wJmIhcLY\n\twgnIQHKMFqAnsDzanrVwX72oOZKUaQqfRo8x2fSTVBMznqyM9GZVBTzLauUCazXOFt1k\n\t/wnY031IC3lKjmhih+h2/fJQsb95B2tpBA1Eq/5v0XkWIb7gLWD0/IwkTgpcvY/LnVSW\n\tL6IA==","X-Gm-Message-State":"AHYfb5iGYsRG6AijIb9J9NLsG+qyy919fy+b5/DCDvDiL6cC6xQ3nnsF\n\tV3vI6P8hRxsnZZvMUHuAntAFdpQpHg==","X-Received":"by 10.84.232.142 with SMTP id i14mr1751769plk.81.1504169060975; \n\tThu, 31 Aug 2017 01:44:20 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAECwjAi=YLG3A1jhNtRZM6CGjgA9FBZWFX5ASFM8dydEnG5ncQ@mail.gmail.com>","References":"<1504099491-25402-1-git-send-email-dedeckeh@gmail.com>\n\t<CAECwjAi=YLG3A1jhNtRZM6CGjgA9FBZWFX5ASFM8dydEnG5ncQ@mail.gmail.com>","From":"Hans Dedecker <dedeckeh@gmail.com>","Date":"Thu, 31 Aug 2017 10:44:20 +0200","Message-ID":"<CAJLcKsFLqA3Oq5b5p8afk6=iAOLXyncnCdR+dME78F3nSRgeFQ@mail.gmail.com>","To":"Yousong Zhou <yszhou4tech@gmail.com>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170831_014442_568526_04EA6CFA ","X-CRM114-Status":"GOOD (  13.16  )","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 [2607:f8b0:400e:c00:0:0:0:244 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":"Re: [LEDE-DEV] [PATCH ubox 2/3] kmodloader: lift restriction on\n\tmodule alias 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":"LEDE Development List <lede-dev@lists.infradead.org>,\n\tJohn Crispin <john@phrozen.org>","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"}},{"id":1760860,"web_url":"http://patchwork.ozlabs.org/comment/1760860/","msgid":"<CAECwjAg0uWpWF4R+B7r3700dVTrYsYgtN-PFDCfY7TPVi1rOhw@mail.gmail.com>","list_archive_url":null,"date":"2017-08-31T11:40:38","subject":"Re: [LEDE-DEV] [PATCH ubox 2/3] kmodloader: lift restriction on\n\tmodule alias info","submitter":{"id":65295,"url":"http://patchwork.ozlabs.org/api/people/65295/","name":"Yousong Zhou","email":"yszhou4tech@gmail.com"},"content":"On 31 August 2017 at 16:44, Hans Dedecker <dedeckeh@gmail.com> wrote:\n> On Wed, Aug 30, 2017 at 4:09 PM, Yousong Zhou <yszhou4tech@gmail.com> wrote:\n>> On 30 August 2017 at 21:24, Hans Dedecker <dedeckeh@gmail.com> wrote:\n>>> kmodloader has a restriction of storing only 32 aliases for a given\n>>> module; as modules can have easily more than 32 aliases let's remove\n>>> the restriction by using a dynamic allocation mechanism when retrieving\n>>> the aliases.\n>>>\n>>> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>\n>>> ---\n>>>  kmodloader.c | 14 ++++++++------\n>>>  1 file changed, 8 insertions(+), 6 deletions(-)\n>>>\n>>> diff --git a/kmodloader.c b/kmodloader.c\n>>> index a4d492d..2ece0c2 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>>>         int fd = open(module, O_RDONLY);\n>>>         unsigned int offset, size;\n>>>         char *map = MAP_FAILED, *strings, *dep = NULL;\n>>> -       const char *aliases[32] = { 0 };\n>>> +       const char **aliases = NULL;\n>>>         int naliases = 0;\n>>>         struct module *m = NULL;\n>>>         struct stat s;\n>>> @@ -383,11 +383,11 @@ static struct module* get_module_info(const char *module, const char *name)\n>>>                 if (!strncmp(strings, \"depends=\", len + 1))\n>>>                         dep = sep;\n>>>                 else if (!strncmp(strings, \"alias=\", len + 1)) {\n>>> -                       if (naliases < ARRAY_SIZE(aliases))\n>>> -                               aliases[naliases++] = sep;\n>>> -                       else\n>>> -                               ULOG_WARN(\"module %s has more than %d aliases: truncated\",\n>>> -                                               name, ARRAY_SIZE(aliases));\n>>> +                       aliases = realloc(aliases, sizeof(sep) * (naliases + 1));\n>>> +                       if (!aliases)\n>>> +                               goto out;\n>>\n>> We should probably just die(\"out of memory\") in this case.  Other than\n>> that, ACK from me ;)\n> My aim was to keep the code consistent when doing OOM error handling\n> as another realloc failure also returned an error code which is\n> handled by the calling function.\n> Having said that I notice the get_module_info return code is not\n> handled by scan_module_folder; would it be ok for you if in the\n> follow-up patch the error code is handled instead of just die ?\n>\n\nDie with message instead of fail silently so that the issue can be\nspotted more quickly.  I think there is really not much we can do in\nthis out of memory situation.  I am okay with both ways of handling it\nas long as it's consistent in the code.\n\nRegards,\n                yousong","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=\"uelwrX6P\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"SFCf5qFd\"; 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 3xjgSd2Lpkz9sQl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 21:41:37 +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 1dnNqf-0003nI-TK; Thu, 31 Aug 2017 11:41:25 +0000","from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnNqb-0003Kz-Ng\n\tfor lede-dev@lists.infradead.org; Thu, 31 Aug 2017 11:41:24 +0000","by mail-yw0-x243.google.com with SMTP id t188so257910ywb.3\n\tfor <lede-dev@lists.infradead.org>;\n\tThu, 31 Aug 2017 04:41:00 -0700 (PDT)","by 10.37.183.76 with HTTP; Thu, 31 Aug 2017 04:40:38 -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:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Subject:To:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=BjBcsY1spwtZzOQXKZ1bCERFTiL6kfeId0RDR3er2Qk=;\n\tb=uelwrX6P6bKKhw\n\tdjqg5TTr1oM9NvSufJCvS0GhUV0FuFZxJ5u9V7O4TJcBsyKsLwiWvMHRsNeJ8xuGZaKGiTR7YTUZj\n\tO8Zl+KQdUJCFZfznCB2TTooXugSTETY+ZKRX6TVZ00oFIPXZ34L0XRVZra5jbrG/f7Zx2hd7y61O+\n\tGPb8l0GZ3d1PrndZmq2b26pKYx1UFTRodRWg80WAHZJg7rN3TEBdu6b1/Le3lVJTp7Zl2KtPjcpTz\n\tkQ2A3sq29ZEXzSHL7AYpL6NC/2juf2QtrdV9dKqADw4V1eVevd8eGM2bHF30SvVOdtD3E3U8X/iND\n\tOnbGTkVN8hLghtRZhfnQ==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=EZlfodjh7yGQPL4n2ExcfUPaCZFLJs4474D70N/sY5E=;\n\tb=SFCf5qFdTCKotYdSn1BzgP0U794/oJc0fV3XWLN/BQRe4A/VZBpuevniGxdCBX8UQo\n\t3Fv+1cTXWr8eXbmyXXhmqYosiny6lPsMT6rqjCgNkpf9HTQUQ/C6/mVaOSd2KmkFXVdL\n\t+0QMgwoUjOzyEZAuIrWg2OCvcAsvVImXn0GqchBL3Jp7bfvTWU1RGvsG8WBBIHFsyuRc\n\t8TWL/U62nuauMDVaokw7J56mwSnNiQl7yGrHJU59Kt5qZ2KgYi80HRIk228tJkv42u1d\n\ttDZuLNwx9h+1KyBPrRg79mkx64sLVTC+W2HZrPkiT/9sT3srYK/9YF8sJfcj7VB/+ttO\n\tvYog=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=EZlfodjh7yGQPL4n2ExcfUPaCZFLJs4474D70N/sY5E=;\n\tb=JGYlspSHy4CxHe4cHlehvt4KD3FPA/Qr8nFhkdj0HTRYG7zaA2q+3ohrt1fFdVSIkK\n\tPXqDBJ123KxjM8W5T49ZJOn8LI+qXQ6a4ATzaQ99LybccqY2ddonbodKnYpM5nb0ZcO7\n\tSr2Wmu1KxvXJtISpwi/OG2wtMsqGk57kW+r5oK2gRmNuZIU+dwd70LZOq7hAlcvAOFV2\n\tPNVGaAUGYiIxfPF6Q3fw1hU/V1Y+p4bRHX/TYtEKTAgtvmYvcsmRt17uvM70qHW9y6OR\n\tHC9WJRgBuJu7OyBJq/L2vdOUPM9V2rWvvpqJvAWFlAjewS2TfTr4MES34mWwldnBOjXg\n\teErw==","X-Gm-Message-State":"AHYfb5iKBI5B6X6HVZOdLQuJK8nM3bheoOIvQoXrorvpm3mXj8LGqYtN\n\tKtDP4kQEE8zLi+4yL//10GrHp3sKnA==","X-Google-Smtp-Source":"ADKCNb48+7m3FINJqFFGEocPfv96NJFa2aU+hI9y6MMclfjv0IGcLZyZGwsi0K869luOmWaEh3rsb8TvxbDGZ5F2TKU=","X-Received":"by 10.129.165.19 with SMTP id c19mr4024293ywh.181.1504179659546; \n\tThu, 31 Aug 2017 04:40:59 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAJLcKsFLqA3Oq5b5p8afk6=iAOLXyncnCdR+dME78F3nSRgeFQ@mail.gmail.com>","References":"<1504099491-25402-1-git-send-email-dedeckeh@gmail.com>\n\t<CAECwjAi=YLG3A1jhNtRZM6CGjgA9FBZWFX5ASFM8dydEnG5ncQ@mail.gmail.com>\n\t<CAJLcKsFLqA3Oq5b5p8afk6=iAOLXyncnCdR+dME78F3nSRgeFQ@mail.gmail.com>","From":"Yousong Zhou <yszhou4tech@gmail.com>","Date":"Thu, 31 Aug 2017 19:40:38 +0800","Message-ID":"<CAECwjAg0uWpWF4R+B7r3700dVTrYsYgtN-PFDCfY7TPVi1rOhw@mail.gmail.com>","To":"Hans Dedecker <dedeckeh@gmail.com>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170831_044121_957767_1DA4C455 ","X-CRM114-Status":"GOOD (  13.77  )","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 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (yszhou4tech[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":"Re: [LEDE-DEV] [PATCH ubox 2/3] kmodloader: lift restriction on\n\tmodule alias 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":"LEDE Development List <lede-dev@lists.infradead.org>,\n\tJohn Crispin <john@phrozen.org>","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"}}]