Re: [PATCH v8 2/2] rust: xarray: Add an abstraction for XArray

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 26, 2024 at 2:53 PM Philipp Stanner <pstanner@xxxxxxxxxx> wrote:
>
> You mean if `ret` was a pointer that, consequently, would have to be
> checked for equality rather then for less-than 0?

No, I meant a C function that happens to return an `int` with
different semantics (e.g. encoding for the error) than the usual ones
(Rust does not allow to compare a raw pointer with an integer).

> The difference is that checkpatch is an additional tool that is not
> tied to the compiler or build chain.

Perhaps a better comparison would be Sparse or Coccinelle then? (i.e.
in that we ideally would test the source code, not the patches, all
the time).

In any case, if you mean to have kernel-only lints, Gary created klint
[1] for that and Julia and Tathagata announced Coccinelle for Rust [2]
some months ago.

We hope we can start putting these tools into good use soon (not to
say they are not useful already, e.g. klint already found actual
issues in the past), ideally running them all the time for all code.

Unless you mean replicating all the compiler diagnostics -- that is
not really feasible (bandwidth-wise) and I am not sure what we would
gain in practice. We don't do that either for kernel C.

[1] https://rust-for-linux.com/klint
[2] https://rust-for-linux.com/coccinelle-for-rust

> Yes, and I think that shouldn't be done. The C coding guideline is more
> of a recommendation.

Kernel C is quite consistent (relative to what you could randomly do
in C), even including the big differences from some subsystems. So, in
practice, some of the guidelines are rules.

For Rust, we had the chance to be even more consistent (thanks to
having the tooling available from the start), and we went for that,
because we see that as a good thing that will pay off long term.

Cheers,
Miguel





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux