lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d7062e1-995b-42bc-8a62-d57c8cb588ee@web.de>
Date: Thu, 21 Mar 2024 21:05:35 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Dan Carpenter <dan.carpenter@...aro.org>,
 kernel-janitors@...r.kernel.org, netdev@...r.kernel.org,
 intel-wired-lan@...ts.osuosl.org,
 Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
 Przemek Kitszel <przemyslaw.kitszel@...el.com>,
 Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
 Alexander Lobakin <aleksander.lobakin@...el.com>,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 David Laight <David.Laight@...lab.com>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>,
 Jesse Brandeburg <jesse.brandeburg@...el.com>, Jiri Pirko
 <jiri@...nulli.us>, Jonathan Cameron <jic23@...nel.org>,
 Julia Lawall <julia.lawall@...ia.fr>, Kees Cook <keescook@...omium.org>,
 Lukasz Czapnik <lukasz.czapnik@...el.com>, Paolo Abeni <pabeni@...hat.com>,
 Pucha Himasekhar Reddy <himasekharx.reddy.pucha@...el.com>
Subject: Re: [PATCH v2 net] ice: Fix freeing uninitialized pointers

> Automatically cleaned up pointers need to be initialized before exiting
> their scope.  In this case, they need to be initialized to NULL before
> any return statement.

Will any adjustments become relevant also for this change description
if scope reductions would become more appealing for affected local variables?

How much can a small script (like the following) for the semantic patch language
(Coccinelle software) help to achieve a better common understanding for
possible source code transformations?

// See also:
// drivers/net/ethernet/intel/ice/ice_common.c
@movement1@
attribute name __free;
@@
-struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
 ... when any
+struct ice_aqc_get_phy_caps_data *
 pcaps
+__free(kfree)
 = kzalloc(sizeof(*pcaps), ...);

@movement2@
attribute name __free;
@@
-void *mac_buf __free(kfree);
 ... when any
+void *
 mac_buf
+__free(kfree)
 = kcalloc(2, sizeof(struct ice_aqc_manage_mac_read_resp), ...);

// See also:
// drivers/net/ethernet/intel/ice/ice_ethtool.c
@movement3@
attribute name __free;
@@
-u8 *tx_frame __free(kfree);
 int i;
 ... when any
 if (ice_fltr_add_mac(test_vsi, ...))
 { ... }
+
+{
+u8 *tx_frame __free(kfree) = NULL;
 if (ice_lbtest_create_frame(pf, &tx_frame, ...))
 { ... }
 ... when any
+}
+
 valid_frames = ice_lbtest_receive_frames(...);


Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ