Re: [PATCH] ceph: bound num_split_inos and num_split_realms in ceph_handle_snap()
From: Michael Bommarito
Date: Wed May 20 2026 - 21:10:38 EST
On Tue, May 19, 2026 at 3:47 PM Viacheslav Dubeyko
<Slava.Dubeyko@xxxxxxx> wrote:
> I am not completely sure that it's good to mention it. Do we have final policy
> accepted?
Yup, it's now required to disclose:
https://docs.kernel.org/process/coding-assistants.html
> We introduced the self-tests recently. And you are welcomed to add KUnit based
> unit-tests.
My bad. I can add one with a patch set in v2.
> I don't where patch uses i variable. What is the point of this change?
> ...
> I am not sure that we really need Claude AI generated comment here. Maybe, some
> short comment is written by human being makes sense. But, currently, I prefer
> completely remove this comment.
Sure, agree.
> > + split_inos_bytes = array_size(num_split_inos, sizeof(u64));
>
> What is the point of this alignment? Claude AI like this? Please, double check
> the generated code and follow to Linux kernel style. Have you run the
> checkpatch.pl script for the patch?
>
That's all my whitespace, not Claude :)
And checkpatch.pl does ret 0 with no warnings/errors. But you're
right that it's not house style, I'll fix it.
>
> Could it be possible that split_inos_bytes or split_realms_bytes are lesser than
> SIZE_MAX but we still could have overflow?
>
> > + check_add_overflow(split_inos_bytes, split_realms_bytes,
> > + &split_bytes) ||
>
> All this check looks like a good candidate for static inline function.
>
> > + (size_t)(e - p) < split_bytes)
>
> The whole check looks complicated and confusing. It's really easy to miss
> something in the logic. I believe that this code requires some refactoring. I am
> not very like the pattern of calculating the split_bytes in the previous
> condition check.
>
> What about this?
>
> split_bytes = size_add(split_inos_bytes, split_realms_bytes);
> if (split_bytes == SIZE_MAX || (size_t)(e - p) < split_bytes)
> goto bad;
Yours does looks more intuitive. I'll refactor those and inline the
check in v2 tomorrow morning.
Thanks,
Mike