Hello,
reading through the compiler warnings I believe there is a potential issue
in /usr/src/sys/kern/kern_ktrace.c At first glance it appears to free
an uninitialized pointer memp.
Regards
int
ktruser(struct proc *p, const char *id, const void *addr, size_t len)
{
struct ktr_header kth;
struct ktr_user ktp;
int error;
//uninitalized
void *memp;
#define STK_PARAMS 128
long long stkbuf[STK_PARAMS / sizeof(long long)];
if (!KTRPOINT(p, KTR_USER))
return (0);
if (len > KTR_USER_MAXLEN)
return (EINVAL);
atomic_setbits_int(&p->p_flag, P_INKTR);
ktrinitheader(&kth, p, KTR_USER);
memset(ktp.ktr_id, 0, KTR_USER_MAXIDLEN);
error = copyinstr(id, ktp.ktr_id, KTR_USER_MAXIDLEN, NULL);
//if error then skip setting memp
if (error)
goto out;
if (len > sizeof(stkbuf))
memp = malloc(len, M_TEMP, M_WAITOK);
else
memp = stkbuf;
error = copyin(addr, memp, len);
if (error)
goto out;
ktrwrite2(p, &kth, &ktp, sizeof(ktp), memp, len);
out:
// frees the uninitialized pointer
if (memp != stkbuf)
free(memp, M_TEMP, len);