Re: [cocci] [RFC] Increasing usage of direct pointer assignments from memcpy() calls with SmPL?

Dan Carpenter <[email protected]>
Newsgroups fr.inria.cocci,org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Oct 30, 2025 at 01:31:49PM +0100, Julia Lawall wrote:
> 
> 
> On Thu, 30 Oct 2025, Markus Elfring wrote:
> > @@ -2600,8 +2600,8 @@ static int __init init_hyp_mode(void)
> >                         goto out_err;
> >                 }
> >
> > +               memcpy(page_address(page), CHOOSE_NVHE_SYM(__per_cpu_start), nvhe_percpu_size());
> >                 page_addr = page_address(page);
> > -               memcpy(page_addr, CHOOSE_NVHE_SYM(__per_cpu_start), nvhe_percpu_size());
> >                 kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu] = (unsigned long)page_addr;
> >         }
> 
> Not sure what is the point of all this.  Try:
> 
> - target = object; memcpy(target, source, size);
> + target = memcpy(target, source, size);

No one will thank you for making these changes...  :(  Please don't do
it.

regards,
dan carpenter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.