Re: [PATCH v2] rust: auxiliary: validate DeviceId name length

From: Alexandre Courbot

Date: Fri Sep 11 2026 - 01:21:12 EST


On Fri Sep 11, 2026 at 12:38 AM JST, Georgios Androutsopoulos wrote:
> `DeviceId::new()` copies `modname` and `name` into the fixed 40-byte
> `auxiliary_device_id::name` array without checking that they fit. An
> oversized name is caught by the array bounds check, but the error
> reports an out-of-bounds index in the copy loop rather than the
> constraint the caller violated.
>
> Check the invariant explicitly instead, so the failure states the length
> limit rather than an array index.
>
> This should only be reached when constructing a device ID table, so the
> failure is a compile time error. Document that intent.
>
> Signed-off-by: Georgios Androutsopoulos <georgeandrout13@xxxxxxxxx>

That's not an essential change, but its concise and helpful to some
degree, so:

Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>