Re: [PATCH 1/7] kcov: apply clang-format to kcov code

From: Alexander Potapenko
Date: Wed Jun 18 2025 - 10:25:55 EST


> > +static inline void kcov_remote_start(u64 handle)
> > +{
> > +}
> > +static inline void kcov_remote_stop(void)
> > +{
> > +}
>
> This excessive-new-line style is not an improvement over previously.
> But nothing we can do about I guess...

I think we'd better stick with whatever clang-format gives us.



> > @@ -728,13 +730,15 @@ static long kcov_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
> > spin_unlock_irqrestore(&kcov->lock, flags);
> > return 0;
> > case KCOV_REMOTE_ENABLE:
> > - if (get_user(remote_num_handles, (unsigned __user *)(arg +
> > - offsetof(struct kcov_remote_arg, num_handles))))
> > + if (get_user(remote_num_handles,
> > + (unsigned __user *)(arg +
> > + offsetof(struct kcov_remote_arg,
> > + num_handles))))
>
> Ouch. Maybe move the address calculation before and assign to
> temporary to avoid this mess?
I factored out offsetof(), because the address calculation looked all
the same after formatting.

> > for_each_possible_cpu(cpu) {
> > void *area = vmalloc_node(CONFIG_KCOV_IRQ_AREA_SIZE *
> > - sizeof(unsigned long), cpu_to_node(cpu));
> > + sizeof(unsigned long),
> > + cpu_to_node(cpu));
>
> Ouch.

Someday we'll probably switch clang-format to 100 columns