rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] rust: kernel: create `overflow_assert!`
@ 2025-05-04 16:43 Antonio Hickey
  2025-05-04 16:43 ` [PATCH 1/1] " Antonio Hickey
  2025-05-05  5:36 ` [PATCH 0/1] " Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Antonio Hickey @ 2025-05-04 16:43 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich
  Cc: Antonio Hickey, rust-for-linux

This patch set introduces a macro for overflow assertions, the use of
this macro will avoid local `#ifdef`s by encapsulating the conditional
behavior to the macro. In addition this macro allows us to document
the intent of the assertion more clearly.

I also intend to add patches that add use of the assertion and 
transform any existing asserts that could make use of it. I just
wanted to get the ball rolling on the review of the macro itself
before getting started with these patches.

Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1159
Suggested-by: Miguel Ojeda <ojeda@kernel.org>


Antonio Hickey (1):
  rust: kernel: create `overflow_assert!`

 rust/kernel/lib.rs             |  1 +
 rust/kernel/overflow_assert.rs | 42 ++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 rust/kernel/overflow_assert.rs

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 0/1] rust: kernel: create `overflow_assert!`
@ 2025-05-04 16:56 Antonio Hickey
  0 siblings, 0 replies; 4+ messages in thread
From: Antonio Hickey @ 2025-05-04 16:56 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich
  Cc: Antonio Hickey, rust-for-linux

This patch set introduces a macro for overflow assertions, the use of
this macro will avoid local `#ifdef`s by encapsulating the conditional
behavior to the macro. In addition this macro allows us to document
the intent of the assertion more clearly.

I also intend to add patches that add use of the assertion and 
transform any existing asserts that could make use of it. I just
wanted to get the ball rolling on the review of the macro itself
before getting started with these patches.

Changes in v2:
- Fixed example doc comment so it doesn't panic.
- Link to v1: https://lore.kernel.org/rust-for-linux/20250504164349.84149-1-contact@antoniohickey.com/

Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1159
Suggested-by: Miguel Ojeda <ojeda@kernel.org>

Antonio Hickey (1):
  rust: kernel: create `overflow_assert!`

 rust/kernel/lib.rs             |  1 +
 rust/kernel/overflow_assert.rs | 42 ++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 rust/kernel/overflow_assert.rs

-- 
2.49.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-05  5:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-04 16:43 [PATCH 0/1] rust: kernel: create `overflow_assert!` Antonio Hickey
2025-05-04 16:43 ` [PATCH 1/1] " Antonio Hickey
2025-05-05  5:36 ` [PATCH 0/1] " Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2025-05-04 16:56 Antonio Hickey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).