Message ID | 20220718221238.5350-2-rosenp@gmail.com |
---|---|
State | Accepted |
Delegated to: | Hauke Mehrtens |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WquTcqHI; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TzHY/rLA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=<UNKNOWN>) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmx9k4lyqz9sGS for <incoming@patchwork.ozlabs.org>; Tue, 19 Jul 2022 08:15:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+gu5Q6lxO4DYFfBeD7HA4T5NaJthaBksxV/3La/rthI=; b=WquTcqHIMk60zF dCO/YhVmr8c7+taOKJnmegD47i+O7Q6/+PGDCzjrXC/VjzPYPgWE1yLdO9E1ME9v/j54dmKusQDJw kd5Wml6aRh6fzXk2JgjJzu1en0LO/HExzN4MBIFAa0DGUP8RW1VgUrA4g1OXSgBbryhp8EEEWRx8O 4dMy6DJU1UTLe/WPTBV/U5xWweycUZql65p2DBNvqQGcGxrooQUV+P5MK9wiMYDCZDELrkILnqAkv 2kehpvws/BhHaTVSYEouOa0y6Q/0JKRqDNljC8cOVh9ESr5We8oSorRUuvEP/p1I+QLkTJqT2Rbx5 Yd4L31D4iFOlg2Gg8I0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDYz4-001yk2-Dk; Mon, 18 Jul 2022 22:12:58 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDYyp-001yMe-Uj for openwrt-devel@lists.openwrt.org; Mon, 18 Jul 2022 22:12:45 +0000 Received: by mail-pj1-x1034.google.com with SMTP id t5-20020a17090a6a0500b001ef965b262eso13970407pjj.5 for <openwrt-devel@lists.openwrt.org>; Mon, 18 Jul 2022 15:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=l6qD9+3gPk39LDFUr3jKhfNQKOPNpvkRBnxV0Jw3nAk=; b=TzHY/rLAnLU2jv2K8nkU4DejU5rmI6JQNh96oR42HGFdkPJTUVF2KBbx986UVlmrwp Cqgx6NtMnzcjD8Y6lyx7JGsTfMFlwUHl4UN1ulCn0T9nKSGJNl6tj8rSJtKRzLAfnv2T sITzyz7XjnO3gUTx9a9N89a1xICXmuK45yn+PS2fYQA9ug5/KiFt97dMmXmurY7wn3Tk Uca4KFUgH2vmG2n9/+15TKLHZX9+k2HhhFa2Mf94+I0Q4urWsDBTFuN+X2PtFny6T+FE QyrPClHVIiYczWiWlLDo1Iau4cLz1dSkHxYqTqDK+tF0c50AqGc0VeEu2n8OI72BVmY7 awYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l6qD9+3gPk39LDFUr3jKhfNQKOPNpvkRBnxV0Jw3nAk=; b=7QjuWFaosdXOEqMuCLCLOhVVnYea6kOpuyqSqvQ6yhWs5no40geNVXckfqDT7xfEvr DbQTsIX9k0VblEw/pl6AmWRZ4pLXqOhmHf2uW8mUWGC6oXn6rq0uA2dV7UEnOGQeJmCK 2mcOYkAjzaNBR3r1Inp0XqsPM0QyQnp2xNCYmELshhDDj0styGq2hhJM2z0lb+0Exut5 UD3Eww1aK0ERKKrMme522cZR5q9NyJsOj7tmyM/s259TvHhKYjqK6OjFRaatLadRunUy KLbjpvfmaDhIAHBkGmDVF7P+ps4AMeRepsOUi48qxfos8tZrnWTXzkdSOBdofgzob4X5 ZrKQ== X-Gm-Message-State: AJIora9hukROSJHHqFmY3XugaxsSXYVVGpqJbmHo5nBAk1vN4H2WLbEx fq/T+YZNJQtAYO8SySvWGpKvkGHSRRA= X-Google-Smtp-Source: AGRyM1sCRpOWNiOs/T+8x0oPaDYZUsAvl8i7eMxBu+EdlY7ENaVqphFhZUv/wGZeduRakz3835rG8g== X-Received: by 2002:a17:90b:1b0d:b0:1ef:9fcb:cdd2 with SMTP id nu13-20020a17090b1b0d00b001ef9fcbcdd2mr35173599pjb.125.1658182361868; Mon, 18 Jul 2022 15:12:41 -0700 (PDT) Received: from ryzen.lan ([2601:648:8600:b53::8c6]) by smtp.gmail.com with ESMTPSA id e20-20020a17090a9a9400b001f1f4b58fedsm192187pjp.46.2022.07.18.15.12.40 for <openwrt-devel@lists.openwrt.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 15:12:40 -0700 (PDT) From: Rosen Penev <rosenp@gmail.com> To: openwrt-devel@lists.openwrt.org Subject: [PATCHv2 2/2] ubox: fix GCC fanalyzer warnings Date: Mon, 18 Jul 2022 15:12:38 -0700 Message-Id: <20220718221238.5350-2-rosenp@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718221238.5350-1-rosenp@gmail.com> References: <20220718221238.5350-1-rosenp@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220718_151244_011179_7013E033 X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: memory leaks and missing NULL checks. Signed-off-by: Rosen Penev --- v2: remove null check for free kmodloader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kmodloader.c b/kmodloader.c index 4b2ffa7..b2e7a8b 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -336,6 +336,11 @@ static int scan_loaded_modules(void) /* possibly a module outside /lib [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1034 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rosenp[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
[PATCHv2,1/2] ubox: fix bad realloc usage
|
expand
|
diff --git a/kmodloader.c b/kmodloader.c index 4b2ffa7..b2e7a8b 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -336,6 +336,11 @@ static int scan_loaded_modules(void) /* possibly a module outside /lib/modules/<ver>/ */ n = alloc_module(m.name, NULL, 0, m.depends, m.size); } + if (!n) { + ULOG_ERR("Failed to allocate memory for module\n"); + return -1; + } + n->usage = m.usage; n->state = LOADED; } @@ -583,6 +588,11 @@ static int insert_module(char *path, const char *options) struct stat s; int fd, ret = -1; + if (!path) { + ULOG_ERR("Path not specified\n"); + return ret; + } + if (stat(path, &s)) { ULOG_ERR("missing module %s\n", path); return ret; @@ -1164,6 +1174,8 @@ load_options(void) continue; } } + + fclose(f); } int main(int argc, char **argv)
memory leaks and missing NULL checks. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- v2: remove null check for free kmodloader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)