On Fri, 05 Dec 2014 18:06:35 -0500, Ted Unangst wrote:

> Here are some bcopy calls in kern that could be memcpy.

Looks good, one comment inline.

> Index: kern_ktrace.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/kern_ktrace.c,v
> retrieving revision 1.70
> diff -u -p -r1.70 kern_ktrace.c
> --- kern_ktrace.c     26 Oct 2014 20:34:37 -0000      1.70
> +++ kern_ktrace.c     5 Dec 2014 22:52:12 -0000
> @@ -132,7 +132,7 @@ ktrinitheader(struct ktr_header *kth, st
>  {
>       ktrinitheaderraw(kth, type, p->p_p->ps_pid,
>           p->p_pid + THREAD_PID_OFFSET);
> -     bcopy(p->p_comm, kth->ktr_comm, MAXCOMLEN);
> +     memcpy(kth->ktr_comm, p->p_comm, MAXCOMLEN);

This could also be made strlcpy() as p->p_comm is a NUL-terminated
string and kth has been zeroed by ktrinitheaderraw().

>  }
>  
>  void

Reply via email to