From: FUJITA Tomonori <fujita.tomonori@gmail.com>
To: boqun.feng@gmail.com
Cc: fujita.tomonori@gmail.com, netdev@vger.kernel.org,
rust-for-linux@vger.kernel.org, aliceryhl@google.com,
andrew@lunn.ch, miguel.ojeda.sandonis@gmail.com
Subject: Re: [PATCH 1/5] rust: core abstractions for network device drivers
Date: Thu, 22 Jun 2023 09:19:46 +0900 (JST) [thread overview]
Message-ID: <20230622.091946.732732192250039677.ubuntu@gmail.com> (raw)
In-Reply-To: <ZJN9WmRCJU8nN9jE@boqun-archlinux>
Hi,
On Wed, 21 Jun 2023 15:44:42 -0700
Boqun Feng <boqun.feng@gmail.com> wrote:
> On Tue, Jun 13, 2023 at 01:53:22PM +0900, FUJITA Tomonori wrote:
>> +impl<D: DriverData, T: DeviceOperations<D>> Registration<T, D> {
>> + /// Creates a new [`Registration`] instance for ethernet device.
>> + ///
>> + /// A device driver can pass private data.
>> + pub fn try_new_ether(tx_queue_size: u32, rx_queue_size: u32, data: D::Data) -> Result<Self> {
>> + // SAFETY: FFI call.
>> + let ptr = from_err_ptr(unsafe {
>> + bindings::alloc_etherdev_mqs(
>> + core::mem::size_of::<*const c_void>() as i32,
>> + tx_queue_size,
>> + rx_queue_size,
>> + )
>> + })?;
>> +
>> + // SAFETY: `ptr` is valid and non-null since `alloc_etherdev_mqs()`
>> + // returned a valid pointer which was null-checked.
>
> Hmm.. neither alloc_etherdev_mqs() nor `from_err_ptr` would do the
> null-check IIUC, so you may get a `ptr` whose values is null here.
Oops, `ptr.is_null()` should be used here instead.
Thanks a lot!
next prev parent reply other threads:[~2023-06-22 0:20 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 4:53 [PATCH 0/5] Rust abstractions for network device drivers FUJITA Tomonori
2023-06-13 4:53 ` [PATCH 1/5] rust: core " FUJITA Tomonori
2023-06-15 13:01 ` Benno Lossin
2023-06-21 13:13 ` FUJITA Tomonori
2023-06-25 9:52 ` Benno Lossin
2023-06-25 14:27 ` FUJITA Tomonori
2023-06-25 17:06 ` Benno Lossin
2023-06-21 22:44 ` Boqun Feng
2023-06-22 0:19 ` FUJITA Tomonori [this message]
2023-06-13 4:53 ` [PATCH 2/5] rust: add support for ethernet operations FUJITA Tomonori
2023-06-13 7:19 ` Ariel Miculas
2023-06-15 13:03 ` Benno Lossin
2023-06-15 13:44 ` Andrew Lunn
2023-06-13 4:53 ` [PATCH 3/5] rust: add support for get_stats64 in struct net_device_ops FUJITA Tomonori
2023-06-13 4:53 ` [PATCH 4/5] rust: add methods for configure net_device FUJITA Tomonori
2023-06-15 13:06 ` Benno Lossin
2023-06-13 4:53 ` [PATCH 5/5] samples: rust: add dummy network driver FUJITA Tomonori
2023-06-15 13:08 ` Benno Lossin
2023-06-22 0:23 ` FUJITA Tomonori
2023-06-15 6:01 ` [PATCH 0/5] Rust abstractions for network device drivers Jakub Kicinski
2023-06-15 8:58 ` Miguel Ojeda
2023-06-16 2:19 ` Jakub Kicinski
2023-06-16 12:18 ` FUJITA Tomonori
2023-06-16 13:23 ` Miguel Ojeda
2023-06-16 13:41 ` FUJITA Tomonori
2023-06-16 18:26 ` Jakub Kicinski
2023-06-16 20:05 ` Miguel Ojeda
2023-06-16 13:04 ` Andrew Lunn
2023-06-16 18:31 ` Jakub Kicinski
2023-06-16 13:18 ` Miguel Ojeda
2023-06-15 12:51 ` Andrew Lunn
2023-06-16 2:02 ` Jakub Kicinski
2023-06-16 3:47 ` Richard Cochran
2023-06-16 17:59 ` Andrew Lunn
2023-06-16 13:02 ` FUJITA Tomonori
2023-06-16 13:14 ` Andrew Lunn
2023-06-16 13:48 ` Miguel Ojeda
2023-06-16 14:43 ` Andrew Lunn
2023-06-16 16:01 ` Miguel Ojeda
2023-06-19 11:27 ` Emilio Cobos Álvarez
2023-06-20 18:09 ` Miguel Ojeda
2023-06-20 19:12 ` Andreas Hindborg (Samsung)
2023-06-21 12:30 ` Andreas Hindborg (Samsung)
2023-06-16 18:40 ` Jakub Kicinski
2023-06-16 19:00 ` Alice Ryhl
2023-06-16 19:10 ` Jakub Kicinski
2023-06-16 19:23 ` Alice Ryhl
2023-06-16 20:04 ` Andrew Lunn
2023-06-17 10:08 ` Alice Ryhl
2023-06-17 10:15 ` Greg KH
2023-06-19 8:50 ` FUJITA Tomonori
2023-06-19 9:46 ` Greg KH
2023-06-19 11:05 ` FUJITA Tomonori
2023-06-19 11:14 ` Greg KH
2023-06-19 13:20 ` Andrew Lunn
2023-06-20 11:16 ` David Laight
2023-06-20 15:47 ` Jakub Kicinski
2023-06-20 16:56 ` Alice Ryhl
2023-06-20 17:44 ` Miguel Ojeda
2023-06-20 17:55 ` Miguel Ojeda
2023-06-16 12:28 ` Alice Ryhl
2023-06-16 13:20 ` Andrew Lunn
2023-06-16 13:24 ` Alice Ryhl
[not found] <20230604021736.3392963-1-tomo@exabit.dev>
2023-06-04 2:17 ` [PATCH 1/5] rust: core " FUJITA Tomonori
2023-06-04 12:47 ` Alice Ryhl
2023-06-05 13:36 ` FUJITA Tomonori
2023-06-08 7:38 ` Alice Ryhl
2023-06-09 12:39 ` FUJITA Tomonori
2023-06-09 13:15 ` Alice Ryhl
2023-06-09 13:23 ` FUJITA Tomonori
2023-06-06 16:20 ` Andrew Lunn
2023-06-07 5:14 ` FUJITA Tomonori
2023-06-08 8:10 ` Alice Ryhl
2023-06-09 12:52 ` FUJITA Tomonori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230622.091946.732732192250039677.ubuntu@gmail.com \
--to=fujita.tomonori@gmail.com \
--cc=aliceryhl@google.com \
--cc=andrew@lunn.ch \
--cc=boqun.feng@gmail.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rust-for-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).