Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp406215rwl; Sat, 24 Dec 2022 23:03:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3y1nwt//GpF5xFDhQxdOlmU/0napIXtfUWP1kJFJWSFGN9YJ7LDBc+4U0jFr9d8cLO1On X-Received: by 2002:a17:902:bd4b:b0:192:6e42:ded5 with SMTP id b11-20020a170902bd4b00b001926e42ded5mr3674221plx.2.1671951780506; Sat, 24 Dec 2022 23:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671951780; cv=none; d=google.com; s=arc-20160816; b=QPAzlA2pyk6QEBg3NVbjK9swBN4sTf+A3UabKLyfnW/AKC2E88mLRA8M85FmpazJ+1 vh496ITOM23Iw9aNJ7eak4WPqgMwWFpP9YH1Dn7tAnRIgsWVLTN6M4nkliobOqKTVBwY gcN6EFOpLyaM3ELcTnbzKO5oL3kX9CdX/T7Wy+p4u/Wy/dl5bZUVjYw0/bXCa67Xxviu icOfPszrn9D6Fhvath+rlBgeTiMBRghIacO4hq1JoeVSxkG3WB7vCC6+wGnBmBFKDaUu uQhRlGie4RMSmJGzyQBrG0t2CNRUdhAm5xU24yXsyH67Pb7Rv46OSl8nFtD1Fd2wrH+w ipfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dsaLD4xQX6KhJrIQDNipCfva2ZF6tm0ZP6l23EoxfMY=; b=FybEzLz1CCV91B09TfceyjXl6yvfPeGQpuq6MSUlAzVJ0K5CI4IcQ1PM/2JVvntsGh vk90I9V75zJQvKkAPOr9D1Ch3ew6BGqb4uYOTOCpvA9DM/4G9Kb3iYe2x7gOGSIv0hlm VxqSfFnak7Ib+QnJPsaSSa+DIGsaXIV2mpA7KdkXRtDkaDoobIAlCy/sJXb5raJFNSCf OUQ1VtvWFYsVM7Ik+0dpDw9WHarpudHex2Yj9HrJrJ4f/ueZlu9W106zOkWX3qOyG9A0 lQaruau2l8V38qUR4WnYTMKi5GqtwRsR5+Wcr+s4OD65u4tNHHTpmMFLI+UZJ0boT14J cynw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@narfation.org header.s=20121 header.b=wn6lqu3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=narfation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b00176a6c988c6si8774422plg.218.2022.12.24.23.02.52; Sat, 24 Dec 2022 23:03:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@narfation.org header.s=20121 header.b=wn6lqu3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=narfation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229969AbiLYGou (ORCPT + 66 others); Sun, 25 Dec 2022 01:44:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiLYGot (ORCPT ); Sun, 25 Dec 2022 01:44:49 -0500 X-Greylist: delayed 430 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 24 Dec 2022 22:44:47 PST Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5B33636D; Sat, 24 Dec 2022 22:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1671950255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dsaLD4xQX6KhJrIQDNipCfva2ZF6tm0ZP6l23EoxfMY=; b=wn6lqu3Rn/s+0IndgwyVj03DCmm7oQMZeP29dBYtu33DPnyesMY6FzEvGJ8+yn2gQEZ/Fl BMBpuuyHc3qi/gYT+nsrpFna01fittg6xlTSFb4+BBSOAts1tGYOU6ej6p3JlJp9vZ5H6A YClkn2dAatx/UXtbNWhi6mvsx/lMI0U= From: Sven Eckelmann To: Artem Chernyshev Cc: Artem Chernyshev , Marek Lindner , Simon Wunderlich , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Markus Pargmann Subject: Re: [PATCH] batman-adv: Check return value Date: Sun, 25 Dec 2022 07:37:28 +0100 Message-ID: <2038034.tdWV9SEqCh@sven-l14> In-Reply-To: <20221224233311.48678-1-artem.chernyshev@red-soft.ru> References: <20221224233311.48678-1-artem.chernyshev@red-soft.ru> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2327203.irdbgypaU6"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart2327203.irdbgypaU6 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii"; protected-headers="v1" From: Sven Eckelmann To: Artem Chernyshev Subject: Re: [PATCH] batman-adv: Check return value Date: Sun, 25 Dec 2022 07:37:28 +0100 Message-ID: <2038034.tdWV9SEqCh@sven-l14> In-Reply-To: <20221224233311.48678-1-artem.chernyshev@red-soft.ru> References: <20221224233311.48678-1-artem.chernyshev@red-soft.ru> MIME-Version: 1.0 Subject is missing something like ..." after calling rtnl_link_register()" or ..."s during module initialization". On Sunday, 25 December 2022 00:33:11 CET Artem Chernyshev wrote: [...] > diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c > index e8a449915566..04cd9682bd29 100644kwin > @@ -113,7 +113,11 @@ static int __init batadv_init(void) > goto err_create_wq; > > register_netdevice_notifier(&batadv_hard_if_notifier); > - rtnl_link_register(&batadv_link_ops); > + ret = rtnl_link_register(&batadv_link_ops); > + if (ret) { > + pr_err("Can't register link_ops\n"); > + goto err_create_wq; > + } > batadv_netlink_register(); > > pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n", > This looks wrong to me. You missed to destroy the batadv_hard_if_notifier in this case. And if you want to start adding the checks, you should also have added it for batadv_v_init, batadv_iv_init, batadv_nc_init, batadv_tp_meter_init and register_netdevice_notifier. You can use the unfinished patch from Markus Pargmann as starting point. Kind regards, Sven [1] https://patchwork.open-mesh.org/project/b.a.t.m.a.n./patch/1419594103-10928-6-git-send-email-mpa@pengutronix.de/ https://lists.open-mesh.org/mailman3/hyperkitty/list/b.a.t.m.a.n@lists.open-mesh.org/thread/QDX46YARWUC4R7OBFHR5OJKWQIXDQWRR/#QDX46YARWUC4R7OBFHR5OJKWQIXDQWRR --nextPart2327203.irdbgypaU6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF10rh2Elc9zjMuACXYcKB8Eme0YFAmOn76kACgkQXYcKB8Em e0Z8zQ/9FXvbfIwkRg+uE3snrtNgmCRkPYlxNfFA/ktC8MAFyXtp6VGWLkQUssBD t6nmbGBTFX9CPR1C8stqIKJnL3GPjldEXesr7zpkCR7ai7J8CsGF0j812hYfIitO P22uzLMrWV/i1APmeee2PJDw4narHGCsgqPePp2vZO43rdqb73z6nbMqVtZT+PqD Tfb70NjmflrHbgh9oP0L+rFfDJMbWuGNv2C4upfeDJss+oulOFEp1XK5scogITJU VyIxj+El+FPAPkKylMiNej4o06O6U464uYjVoPlgQRkXzyfIA7nuc4qtaUktJqNb wu9gKDL8DMGaOmIHUSm2FFLxcOi1HCSRl5D9mSPAXb8OTL8vnaOEg/Y4UKZRhEhH lZVKi5y7ncIZlTMGgGl8YMPq/zJR+cPSVdeDhhUhMqkNxWeqhPzf4kDEf+sYuMFW XgD9eDY/+o0tQol1zWQOLysUA1flLKanOtLxBHjv5v2EkXLh43GZQSHWT1R5tTKX ssM3GmZ3nObg6aVUBOIlE15Wi/WuzsL7l2JT7ZlvD6jnE85hesJU+9V46KAEg60k vCzwzEnpoz+xWYxy1hTaDln62PIBL53K9TliMkTZCflKgGMkIqidSbY0C2+F32d7 dC8OKU4/i+y0+5axnqxsdT21hE/W0DoXb46HxaluNF+jYR9hiJU= =YzUQ -----END PGP SIGNATURE----- --nextPart2327203.irdbgypaU6--