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-next>] [day] [month] [year] [list]
Message-ID: <20241031002326.3426181-1-csander@purestorage.com>
Date: Wed, 30 Oct 2024 18:23:25 -0600
From: Caleb Sander Mateos <csander@...estorage.com>
To: Andrew Lunn <andrew+netdev@...n.ch>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	Arthur Kiyanovski <akiyano@...zon.com>,
	Brett Creeley <brett.creeley@....com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	Claudiu Manoil <claudiu.manoil@....com>,
	David Arinzon <darinzon@...zon.com>,
	"David S. Miller" <davem@...emloft.net>,
	Doug Berger <opendmb@...il.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Eugenio PĂ©rez <eperezma@...hat.com>,
	Felix Fietkau <nbd@....name>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Geetha sowjanya <gakula@...vell.com>,
	hariprasad <hkelam@...vell.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Jason Wang <jasowang@...hat.com>,
	Jonathan Corbet <corbet@....net>,
	Leon Romanovsky <leon@...nel.org>,
	Lorenzo Bianconi <lorenzo@...nel.org>,
	Louis Peens <louis.peens@...igine.com>,
	Mark Lee <Mark-MC.Lee@...iatek.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	Michael Chan <michael.chan@...adcom.com>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Noam Dagan <ndagan@...zon.com>,
	Paolo Abeni <pabeni@...hat.com>,
	Przemek Kitszel <przemyslaw.kitszel@...el.com>,
	Roy Pledge <Roy.Pledge@....com>,
	Saeed Bishara <saeedb@...zon.com>,
	Saeed Mahameed <saeedm@...dia.com>,
	Sean Wang <sean.wang@...iatek.com>,
	Shannon Nelson <shannon.nelson@....com>,
	Shay Agroskin <shayagr@...zon.com>,
	Simon Horman <horms@...nel.org>,
	Subbaraya Sundeep <sbhatta@...vell.com>,
	Sunil Goutham <sgoutham@...vell.com>,
	Tal Gilboa <talgi@...dia.com>,
	Tariq Toukan <tariqt@...dia.com>,
	Tony Nguyen <anthony.l.nguyen@...el.com>,
	Vladimir Oltean <vladimir.oltean@....com>,
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: Caleb Sander Mateos <csander@...estorage.com>,
	intel-wired-lan@...ts.osuosl.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-mediatek@...ts.infradead.org,
	linuxppc-dev@...ts.ozlabs.org,
	linux-rdma@...r.kernel.org,
	netdev@...r.kernel.org,
	oss-drivers@...igine.com,
	virtualization@...ts.linux.dev
Subject: [resend PATCH 1/2] dim: make dim_calc_stats() inputs const pointers

Make the start and end arguments to dim_calc_stats() const pointers
to clarify that the function does not modify their values.

Signed-off-by: Caleb Sander Mateos <csander@...estorage.com>
---
 include/linux/dim.h | 3 ++-
 lib/dim/dim.c       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/dim.h b/include/linux/dim.h
index 1b581ff25a15..84579a50ae7f 100644
--- a/include/linux/dim.h
+++ b/include/linux/dim.h
@@ -349,11 +349,12 @@ void dim_park_tired(struct dim *dim);
  *
  * Calculate the delta between two samples (in data rates).
  * Takes into consideration counter wrap-around.
  * Returned boolean indicates whether curr_stats are reliable.
  */
-bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
+bool dim_calc_stats(const struct dim_sample *start,
+		    const struct dim_sample *end,
 		    struct dim_stats *curr_stats);
 
 /**
  *	dim_update_sample - set a sample's fields with given values
  *	@event_ctr: number of events to set
diff --git a/lib/dim/dim.c b/lib/dim/dim.c
index 83b65ac74d73..97c3d084ebf0 100644
--- a/lib/dim/dim.c
+++ b/lib/dim/dim.c
@@ -52,11 +52,12 @@ void dim_park_tired(struct dim *dim)
 	dim->steps_left   = 0;
 	dim->tune_state   = DIM_PARKING_TIRED;
 }
 EXPORT_SYMBOL(dim_park_tired);
 
-bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
+bool dim_calc_stats(const struct dim_sample *start,
+		    const struct dim_sample *end,
 		    struct dim_stats *curr_stats)
 {
 	/* u32 holds up to 71 minutes, should be enough */
 	u32 delta_us = ktime_us_delta(end->time, start->time);
 	u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ