summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/arch/alpha/linux_machdep.c8
-rw-r--r--sys/compat/linux/arch/alpha/linux_osf1.c9
-rw-r--r--sys/compat/linux/arch/amd64/linux_machdep.c5
-rw-r--r--sys/compat/linux/arch/arm/linux_machdep.c6
-rw-r--r--sys/compat/linux/arch/arm/linux_ptrace.c5
-rw-r--r--sys/compat/linux/arch/i386/linux_machdep.c11
-rw-r--r--sys/compat/linux/arch/i386/linux_ptrace.c5
-rw-r--r--sys/compat/linux/arch/m68k/linux_machdep.c8
-rw-r--r--sys/compat/linux/arch/mips/linux_machdep.c5
-rw-r--r--sys/compat/linux/arch/powerpc/linux_exec_powerpc.c6
-rw-r--r--sys/compat/linux/arch/powerpc/linux_machdep.c5
-rw-r--r--sys/compat/linux/arch/powerpc/linux_ptrace.c7
-rw-r--r--sys/compat/linux/common/linux_cdrom.c6
-rw-r--r--sys/compat/linux/common/linux_fdio.c5
-rw-r--r--sys/compat/linux/common/linux_file.c5
-rw-r--r--sys/compat/linux/common/linux_hdio.c6
-rw-r--r--sys/compat/linux/common/linux_misc.c7
-rw-r--r--sys/compat/linux/common/linux_mtio.c5
-rw-r--r--sys/compat/linux/common/linux_oldolduname.c6
-rw-r--r--sys/compat/linux/common/linux_olduname.c6
-rw-r--r--sys/compat/linux/common/linux_sched.c6
-rw-r--r--sys/compat/linux/common/linux_signal.c12
-rw-r--r--sys/compat/linux/common/linux_socket.c7
-rw-r--r--sys/compat/linux/common/linux_time.c6
24 files changed, 106 insertions, 51 deletions
diff --git a/sys/compat/linux/arch/alpha/linux_machdep.c b/sys/compat/linux/arch/alpha/linux_machdep.c
index 158debcbe4a..1f5c48fb3c4 100644
--- a/sys/compat/linux/arch/alpha/linux_machdep.c
+++ b/sys/compat/linux/arch/alpha/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.50 2014/11/09 17:48:07 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.50.24.1 2022/08/03 11:11:33 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50 2014/11/09 17:48:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50.24.1 2022/08/03 11:11:33 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -139,6 +139,8 @@ setup_linux_rt_sigframe(struct trapframe *tf, const ksiginfo_t *ksi,
sig, &onstack, sfp);
#endif /* DEBUG */
+ memset(&sigframe, 0, sizeof(sigframe));
+
/*
* Build the signal context to be used by sigreturn.
*/
@@ -232,6 +234,8 @@ void setup_linux_sigframe(struct trapframe *tf, const ksiginfo_t *ksi,
sig, &onstack, sfp);
#endif /* DEBUG */
+ memset(&sigframe, 0, sizeof(sigframe));
+
/*
* Build the signal context to be used by sigreturn.
*/
diff --git a/sys/compat/linux/arch/alpha/linux_osf1.c b/sys/compat/linux/arch/alpha/linux_osf1.c
index 6383521c43c..ade07dc74a5 100644
--- a/sys/compat/linux/arch/alpha/linux_osf1.c
+++ b/sys/compat/linux/arch/alpha/linux_osf1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_osf1.c,v 1.3 2019/04/06 03:06:28 thorpej Exp $ */
+/* $NetBSD: linux_osf1.c,v 1.3.6.1 2022/08/03 11:11:33 martin Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_osf1.c,v 1.3 2019/04/06 03:06:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_osf1.c,v 1.3.6.1 2022/08/03 11:11:33 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -109,6 +109,8 @@ static void
osf1_cvt_rusage_from_native(const struct rusage *ru, struct osf1_rusage *oru)
{
+ memset(oru, 0, sizeof(*oru));
+
oru->ru_utime.tv_sec = ru->ru_utime.tv_sec;
oru->ru_utime.tv_usec = ru->ru_utime.tv_usec;
@@ -135,7 +137,7 @@ static void
osf1_cvt_statfs_from_native(const struct statvfs *bsfs, struct osf1_statfs *osfs)
{
- memset(osfs, 0, sizeof (struct osf1_statfs));
+ memset(osfs, 0, sizeof(*osfs));
if (!strncmp(MOUNT_FFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
osfs->f_type = OSF1_MOUNT_UFS;
else if (!strncmp(MOUNT_NFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
@@ -663,6 +665,7 @@ linux_sys_osf1_usleep_thread(struct lwp *l, const struct linux_sys_osf1_usleep_t
if (endtv.tv_sec < 0 || endtv.tv_usec < 0)
endtv.tv_sec = endtv.tv_usec = 0;
+ memset(&endotv, 0, sizeof(endotv));
endotv.tv_sec = endtv.tv_sec;
endotv.tv_usec = endtv.tv_usec;
error = copyout(&endotv, SCARG(uap, slept), sizeof endotv);
diff --git a/sys/compat/linux/arch/amd64/linux_machdep.c b/sys/compat/linux/arch/amd64/linux_machdep.c
index 9a9b9f7e42c..28ff7c4eecc 100644
--- a/sys/compat/linux/arch/amd64/linux_machdep.c
+++ b/sys/compat/linux/arch/amd64/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.58.2.1 2019/09/13 06:25:25 martin Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.58.2.2 2022/08/03 11:11:33 martin Exp $ */
/*-
* Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.58.2.1 2019/09/13 06:25:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.58.2.2 2022/08/03 11:11:33 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -227,6 +227,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
if (fpsp != NULL) {
size_t fp_size = sizeof fpregs;
/* The netbsd and linux structures both match the fxsave data */
+ memset(&fpregs, 0, sizeof(fpregs));
(void)process_read_fpregs(l, &fpregs, &fp_size);
error = copyout(&fpregs, fpsp, sizeof(*fpsp));
}
diff --git a/sys/compat/linux/arch/arm/linux_machdep.c b/sys/compat/linux/arch/arm/linux_machdep.c
index 9f430803506..70f32e4c528 100644
--- a/sys/compat/linux/arch/arm/linux_machdep.c
+++ b/sys/compat/linux/arch/arm/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.32 2014/11/09 17:48:07 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.32.24.1 2022/08/03 11:11:33 martin Exp $ */
/*-
* Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.32 2014/11/09 17:48:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.32.24.1 2022/08/03 11:11:33 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -107,6 +107,8 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
/* Build stack frame for signal trampoline. */
+ memset(&frame, 0, sizeof(frame));
+
/* Save register context. */
frame.sf_sc.sc_r0 = tf->tf_r0;
frame.sf_sc.sc_r1 = tf->tf_r1;
diff --git a/sys/compat/linux/arch/arm/linux_ptrace.c b/sys/compat/linux/arch/arm/linux_ptrace.c
index a13b64f51f7..dbc43e2c0b7 100644
--- a/sys/compat/linux/arch/arm/linux_ptrace.c
+++ b/sys/compat/linux/arch/arm/linux_ptrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ptrace.c,v 1.21 2018/01/26 09:29:15 christos Exp $ */
+/* $NetBSD: linux_ptrace.c,v 1.21.8.1 2022/08/03 11:11:33 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.21 2018/01/26 09:29:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.21.8.1 2022/08/03 11:11:33 martin Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -180,6 +180,7 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
if (error) {
break;
}
+ memset(linux_regs, 0, sizeof(*linux_regs));
memcpy(linux_regs->uregs, regs->r, 13 * sizeof(register_t));
linux_regs->uregs[LINUX_REG_SP] = regs->r_sp;
linux_regs->uregs[LINUX_REG_LR] = regs->r_lr;
diff --git a/sys/compat/linux/arch/i386/linux_machdep.c b/sys/compat/linux/arch/i386/linux_machdep.c
index 0a6b4272e0b..30607bd8f11 100644
--- a/sys/compat/linux/arch/i386/linux_machdep.c
+++ b/sys/compat/linux/arch/i386/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.166 2019/05/19 08:46:15 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.166.2.1 2022/08/03 11:11:31 martin Exp $ */
/*-
* Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.166 2019/05/19 08:46:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.166.2.1 2022/08/03 11:11:31 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_user_ldt.h"
@@ -252,6 +252,8 @@ linux_rt_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
onstack, fp, sig, tf->tf_eip,
((struct pcb *)lwp_getpcb(l))->pcb_cr2));
+ memset(&frame, 0, sizeof(frame));
+
/* Build stack frame for signal trampoline. */
frame.sf_handler = catcher;
frame.sf_sig = native_to_linux_signo[sig];
@@ -329,6 +331,8 @@ linux_old_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
onstack, fp, sig, tf->tf_eip,
((struct pcb *)lwp_getpcb(l))->pcb_cr2));
+ memset(&frame, 0, sizeof(frame));
+
/* Build stack frame for signal trampoline. */
frame.sf_handler = catcher;
frame.sf_sig = native_to_linux_signo[sig];
@@ -837,6 +841,7 @@ linux_machdepioctl(struct lwp *l, const struct linux_sys_ioctl_args *uap, regist
com = VT_OPENQRY;
break;
case LINUX_VT_GETMODE:
+ memset(&lvt, 0, sizeof(lvt));
error = fp->f_ops->fo_ioctl(fp, VT_GETMODE, &lvt);
if (error != 0)
goto out;
@@ -932,6 +937,7 @@ linux_machdepioctl(struct lwp *l, const struct linux_sys_ioctl_args *uap, regist
sectors = label.d_nsectors;
}
if (com == LINUX_HDIO_GETGEO) {
+ memset(&hdg, 0, sizeof(hdg));
hdg.start = start;
hdg.heads = heads;
hdg.cylinders = cylinders;
@@ -939,6 +945,7 @@ linux_machdepioctl(struct lwp *l, const struct linux_sys_ioctl_args *uap, regist
error = copyout(&hdg, SCARG(uap, data), sizeof hdg);
goto out;
} else {
+ memset(&hdg_big, 0, sizeof(hdg_big));
hdg_big.start = start;
hdg_big.heads = heads;
hdg_big.cylinders = cylinders;
diff --git a/sys/compat/linux/arch/i386/linux_ptrace.c b/sys/compat/linux/arch/i386/linux_ptrace.c
index 65ef6a22157..250772e23d4 100644
--- a/sys/compat/linux/arch/i386/linux_ptrace.c
+++ b/sys/compat/linux/arch/i386/linux_ptrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ptrace.c,v 1.33 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: linux_ptrace.c,v 1.33.4.1 2022/08/03 11:11:31 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.33 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.33.4.1 2022/08/03 11:11:31 martin Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -223,6 +223,7 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
if (error) {
break;
}
+ memset(linux_regs, 0, sizeof(*linux_regs));
linux_regs->ebx = regs->r_ebx;
linux_regs->ecx = regs->r_ecx;
linux_regs->edx = regs->r_edx;
diff --git a/sys/compat/linux/arch/m68k/linux_machdep.c b/sys/compat/linux/arch/m68k/linux_machdep.c
index 115f9f2e7c1..dedc08e6781 100644
--- a/sys/compat/linux/arch/m68k/linux_machdep.c
+++ b/sys/compat/linux/arch/m68k/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.42 2010/07/07 01:30:34 chs Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.42.64.1 2022/08/03 11:11:33 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.42 2010/07/07 01:30:34 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.42.64.1 2022/08/03 11:11:33 martin Exp $");
#define COMPAT_LINUX 1
@@ -118,6 +118,8 @@ setup_linux_sigframe(struct frame *frame, int sig, const sigset_t *mask, void *u
p->p_pid, sig, &ft, fp, &fp->sf_c.c_sc, ft);
#endif
+ memset(&kf, 0, sizeof(kf));
+
/* Build stack frame. */
kf.sf_psigtramp = fp->sf_sigtramp; /* return addr for handler */
kf.sf_signum = native_to_linux_signo[sig];
@@ -280,6 +282,8 @@ setup_linux_rt_sigframe(struct frame *frame, int sig, const sigset_t *mask, void
p->p_pid, sig, &ft, fp, &fp->sf_uc, ft);
#endif
+ memset(&kf, 0, sizeof(kf));
+
/* Build stack frame. */
kf.sf_psigtramp = fp->sf_sigtramp; /* return addr for handler */
kf.sf_signum = native_to_linux_signo[sig];
diff --git a/sys/compat/linux/arch/mips/linux_machdep.c b/sys/compat/linux/arch/mips/linux_machdep.c
index 872d509c734..623ceed1c11 100644
--- a/sys/compat/linux/arch/mips/linux_machdep.c
+++ b/sys/compat/linux/arch/mips/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.43 2014/11/09 17:48:07 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.43.24.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.43 2014/11/09 17:48:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.43.24.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -401,6 +401,7 @@ linux_sys_new_uname(struct lwp *l, const struct linux_sys_new_uname_args *uap, r
} */ *uap = v;
struct linux_utsname luts;
+ memset(&luts, 0, sizeof(luts));
strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname));
strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
strlcpy(luts.l_release, "2.4.0", sizeof(luts.l_release));
diff --git a/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c b/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c
index 4509ccc2eda..5442a677daa 100644
--- a/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c
+++ b/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_exec_powerpc.c,v 1.24 2012/02/21 18:10:00 rjs Exp $ */
+/* $NetBSD: linux_exec_powerpc.c,v 1.24.44.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_powerpc.c,v 1.24 2012/02/21 18:10:00 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_powerpc.c,v 1.24.44.1 2022/08/03 11:11:32 martin Exp $");
#define ELFSIZE 32
@@ -93,7 +93,7 @@ ELFNAME2(linux,copyargs)(struct lwp *l, struct exec_package *pack,
& ~LINUX_SHIFT);
#endif
- memset(ai, 0, sizeof(AuxInfo) * LINUX_ELF_AUX_ENTRIES);
+ memset(ai, 0, sizeof(ai));
a = ai;
diff --git a/sys/compat/linux/arch/powerpc/linux_machdep.c b/sys/compat/linux/arch/powerpc/linux_machdep.c
index da282bbb84a..46296616401 100644
--- a/sys/compat/linux/arch/powerpc/linux_machdep.c
+++ b/sys/compat/linux/arch/powerpc/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.50 2017/05/03 00:23:42 chs Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.50.14.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50 2017/05/03 00:23:42 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50.14.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -162,6 +162,7 @@ linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
*
* Save register context.
*/
+ memset(&linux_regs, 0, sizeof(linux_regs));
for (i = 0; i < 32; i++)
linux_regs.lgpr[i] = tf->tf_fixreg[i];
linux_regs.lnip = tf->tf_srr0;
diff --git a/sys/compat/linux/arch/powerpc/linux_ptrace.c b/sys/compat/linux/arch/powerpc/linux_ptrace.c
index 4b25f4e1a78..11783ab1fdd 100644
--- a/sys/compat/linux/arch/powerpc/linux_ptrace.c
+++ b/sys/compat/linux/arch/powerpc/linux_ptrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ptrace.c,v 1.31 2018/09/03 16:29:29 riastradh Exp $ */
+/* $NetBSD: linux_ptrace.c,v 1.31.4.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.31 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.31.4.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -200,6 +200,7 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
if (error) {
break;
}
+ memset(linux_regs, 0, sizeof(*linux_regs));
for (i = 0; i <= 31; i++) {
linux_regs->lgpr[i] = regs->fixreg[i];
}
@@ -309,7 +310,7 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
break;
}
error = copyout (retval, (void *)SCARG(uap, data),
- sizeof(retval));
+ sizeof(*retval));
*retval = SCARG(uap, data);
break;
diff --git a/sys/compat/linux/common/linux_cdrom.c b/sys/compat/linux/common/linux_cdrom.c
index 07d84540c02..ba34c44c5e0 100644
--- a/sys/compat/linux/common/linux_cdrom.c
+++ b/sys/compat/linux/common/linux_cdrom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_cdrom.c,v 1.27 2008/04/28 20:23:43 martin Exp $ */
+/* $NetBSD: linux_cdrom.c,v 1.27.92.1 2022/08/03 11:11:32 martin Exp $ */
/*
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.27 2008/04/28 20:23:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.27.92.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -186,6 +186,7 @@ linux_ioctl_cdrom(struct lwp *l, const struct linux_sys_ioctl_args *uap, registe
if (error)
break;
+ memset(&l_tochdr, 0, sizeof(l_tochdr));
l_tochdr.cdth_trk0 = t_header.starting_track;
l_tochdr.cdth_trk1 = t_header.ending_track;
@@ -238,6 +239,7 @@ linux_ioctl_cdrom(struct lwp *l, const struct linux_sys_ioctl_args *uap, registe
if (error)
break;
+ memset(&l_volctrl, 0, sizeof(l_volctrl));
l_volctrl.channel0 = t_vol.vol[0];
l_volctrl.channel1 = t_vol.vol[1];
l_volctrl.channel2 = t_vol.vol[2];
diff --git a/sys/compat/linux/common/linux_fdio.c b/sys/compat/linux/common/linux_fdio.c
index bf9b5be0590..6e2346d3dcd 100644
--- a/sys/compat/linux/common/linux_fdio.c
+++ b/sys/compat/linux/common/linux_fdio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_fdio.c,v 1.13 2008/03/21 21:54:58 ad Exp $ */
+/* $NetBSD: linux_fdio.c,v 1.13.96.1 2022/08/03 11:11:32 martin Exp $ */
/*
* Copyright (c) 2000 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.13 2008/03/21 21:54:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.13.96.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -107,6 +107,7 @@ linux_ioctl_fdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
error = ioctlf(fp, FDIOCGETFORMAT, &fparams);
if (error != 0)
break;
+ memset(&lflop, 0, sizeof(lflop));
lflop.size = fparams.ncyl * fparams.nspt * fparams.ntrk;
lflop.sect = fparams.nspt;
lflop.head = fparams.ntrk;
diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c
index 446cc172fc4..d351fdb17dd 100644
--- a/sys/compat/linux/common/linux_file.c
+++ b/sys/compat/linux/common/linux_file.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file.c,v 1.116 2019/06/18 22:34:25 kamil Exp $ */
+/* $NetBSD: linux_file.c,v 1.116.2.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.116 2019/06/18 22:34:25 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.116.2.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -445,6 +445,7 @@ static void
bsd_to_linux_stat(struct stat *bsp, struct linux_stat *lsp)
{
+ memset(lsp, 0, sizeof(*lsp));
lsp->lst_dev = linux_fakedev(bsp->st_dev, 0);
lsp->lst_ino = bsp->st_ino;
lsp->lst_mode = (linux_mode_t)bsp->st_mode;
diff --git a/sys/compat/linux/common/linux_hdio.c b/sys/compat/linux/common/linux_hdio.c
index 79300d3ebd0..219881f6bea 100644
--- a/sys/compat/linux/common/linux_hdio.c
+++ b/sys/compat/linux/common/linux_hdio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_hdio.c,v 1.18 2019/02/03 03:19:26 mrg Exp $ */
+/* $NetBSD: linux_hdio.c,v 1.18.4.1 2022/08/03 11:11:32 martin Exp $ */
/*
* Copyright (c) 2000 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.18 2019/02/03 03:19:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.18.4.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -113,6 +113,7 @@ linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
error = error1;
break;
}
+ memset(&hdg, 0, sizeof(hdg));
hdg.start = error1 != 0 ? pi.pi_offset : 0;
hdg.heads = label.d_ntracks;
hdg.cylinders = label.d_ncylinders;
@@ -131,6 +132,7 @@ linux_ioctl_hdio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
error = error1;
break;
}
+ memset(&hdg_big, 0, sizeof(hdg_big));
hdg_big.start = error1 != 0 ? pi.pi_offset : 0;
hdg_big.heads = label.d_ntracks;
hdg_big.cylinders = label.d_ncylinders;
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index ac472d551f9..e81add112ba 100644
--- a/sys/compat/linux/common/linux_misc.c
+++ b/sys/compat/linux/common/linux_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.240.4.1 2019/09/13 06:25:25 martin Exp $ */
+/* $NetBSD: linux_misc.c,v 1.240.4.2 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.240.4.1 2019/09/13 06:25:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.240.4.2 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -628,6 +628,8 @@ linux_sys_times(struct lwp *l, const struct linux_sys_times_args *uap, register_
struct linux_tms ltms;
struct rusage ru;
+ memset(&ltms, 0, sizeof(ltms));
+
mutex_enter(p->p_lock);
calcru(p, &ru.ru_utime, &ru.ru_stime, NULL, NULL);
ltms.ltms_utime = CONVTCK(ru.ru_utime);
@@ -1392,6 +1394,7 @@ linux_sys_getrlimit(struct lwp *l, const struct linux_sys_getrlimit_args *uap, r
if (which < 0)
return -which;
+ memset(&orl, 0, sizeof(orl));
bsd_to_linux_rlimit(&orl, &l->l_proc->p_rlimit[which]);
return copyout(&orl, SCARG(uap, rlp), sizeof(orl));
diff --git a/sys/compat/linux/common/linux_mtio.c b/sys/compat/linux/common/linux_mtio.c
index b92051d65f2..7e47bff2274 100644
--- a/sys/compat/linux/common/linux_mtio.c
+++ b/sys/compat/linux/common/linux_mtio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_mtio.c,v 1.7 2008/03/21 21:54:58 ad Exp $ */
+/* $NetBSD: linux_mtio.c,v 1.7.96.1 2022/08/03 11:11:32 martin Exp $ */
/*
* Copyright (c) 2005 Soren S. Jorvang. All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.7 2008/03/21 21:54:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.7.96.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -106,6 +106,7 @@ linux_ioctl_mtio(struct lwp *l, const struct linux_sys_ioctl_args *uap,
error = ioctlf(fp, MTIOCTOP, &mt);
break;
case LINUX_MTIOCGET:
+ memset(&lmtget, 0, sizeof(lmtget));
lmtget.mt_type = LINUX_MT_ISUNKNOWN;
lmtget.mt_resid = 0;
lmtget.mt_dsreg = 0;
diff --git a/sys/compat/linux/common/linux_oldolduname.c b/sys/compat/linux/common/linux_oldolduname.c
index c48939d49e5..1a9ec1f2f68 100644
--- a/sys/compat/linux/common/linux_oldolduname.c
+++ b/sys/compat/linux/common/linux_oldolduname.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_oldolduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $ */
+/* $NetBSD: linux_oldolduname.c,v 1.66.92.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.66.92.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,6 +58,8 @@ linux_sys_oldolduname(struct lwp *l, const struct linux_sys_oldolduname_args *ua
} */
struct linux_oldoldutsname luts;
+ memset(&luts, 0, sizeof(luts));
+
strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname));
strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
strlcpy(luts.l_release, linux_release, sizeof(luts.l_release));
diff --git a/sys/compat/linux/common/linux_olduname.c b/sys/compat/linux/common/linux_olduname.c
index 20f9cde0581..a57434339b2 100644
--- a/sys/compat/linux/common/linux_olduname.c
+++ b/sys/compat/linux/common/linux_olduname.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_olduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $ */
+/* $NetBSD: linux_olduname.c,v 1.66.92.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.66.92.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,6 +61,8 @@ linux_sys_olduname(struct lwp *l, const struct linux_sys_olduname_args *uap, reg
} */
struct linux_oldutsname luts;
+ memset(&luts, 0, sizeof(luts));
+
strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname));
strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
strlcpy(luts.l_release, linux_release, sizeof(luts.l_release));
diff --git a/sys/compat/linux/common/linux_sched.c b/sys/compat/linux/common/linux_sched.c
index 63e5964c229..3ba701c611b 100644
--- a/sys/compat/linux/common/linux_sched.c
+++ b/sys/compat/linux/common/linux_sched.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sched.c,v 1.71 2018/04/16 14:51:59 kamil Exp $ */
+/* $NetBSD: linux_sched.c,v 1.71.6.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.71 2018/04/16 14:51:59 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.71.6.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -380,6 +380,8 @@ sched_native2linux(int native_policy, struct sched_param *native_params,
KASSERT(prio <= SCHED_PRI_MAX);
KASSERT(linux_params != NULL);
+ memset(linux_params, 0, sizeof(*linux_params));
+
DPRINTF(("%s: native: policy %d, priority %d\n",
__func__, native_policy, prio));
diff --git a/sys/compat/linux/common/linux_signal.c b/sys/compat/linux/common/linux_signal.c
index 2bb920ba396..b3fc8cbe3e3 100644
--- a/sys/compat/linux/common/linux_signal.c
+++ b/sys/compat/linux/common/linux_signal.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_signal.c,v 1.80.8.1 2019/09/13 06:25:25 martin Exp $ */
+/* $NetBSD: linux_signal.c,v 1.80.8.2 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.80.8.1 2019/09/13 06:25:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.80.8.2 2022/08/03 11:11:32 martin Exp $");
#define COMPAT_LINUX 1
@@ -274,6 +274,8 @@ linux_to_native_sigflags(const unsigned long lsf)
void
linux_old_to_native_sigaction(struct sigaction *bsa, const struct linux_old_sigaction *lsa)
{
+
+ memset(bsa, 0, sizeof(*bsa));
bsa->sa_handler = lsa->linux_sa_handler;
linux_old_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask);
bsa->sa_flags = linux_to_native_sigflags(lsa->linux_sa_flags);
@@ -282,6 +284,8 @@ linux_old_to_native_sigaction(struct sigaction *bsa, const struct linux_old_siga
void
native_to_linux_old_sigaction(struct linux_old_sigaction *lsa, const struct sigaction *bsa)
{
+
+ memset(lsa, 0, sizeof(*lsa));
lsa->linux_sa_handler = bsa->sa_handler;
native_to_linux_old_sigset(&lsa->linux_sa_mask, &bsa->sa_mask);
lsa->linux_sa_flags = native_to_linux_sigflags(bsa->sa_flags);
@@ -294,6 +298,8 @@ native_to_linux_old_sigaction(struct linux_old_sigaction *lsa, const struct siga
void
linux_to_native_sigaction(struct sigaction *bsa, const struct linux_sigaction *lsa)
{
+
+ memset(bsa, 0, sizeof(*bsa));
bsa->sa_handler = lsa->linux_sa_handler;
linux_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask);
bsa->sa_flags = linux_to_native_sigflags(lsa->linux_sa_flags);
@@ -302,6 +308,8 @@ linux_to_native_sigaction(struct sigaction *bsa, const struct linux_sigaction *l
void
native_to_linux_sigaction(struct linux_sigaction *lsa, const struct sigaction *bsa)
{
+
+ memset(lsa, 0, sizeof(*lsa));
lsa->linux_sa_handler = bsa->sa_handler;
native_to_linux_sigset(&lsa->linux_sa_mask, &bsa->sa_mask);
lsa->linux_sa_flags = native_to_linux_sigflags(bsa->sa_flags);
diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c
index 00351a67c64..015018ea30b 100644
--- a/sys/compat/linux/common/linux_socket.c
+++ b/sys/compat/linux/common/linux_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.145.4.3 2020/11/08 08:39:12 martin Exp $ */
+/* $NetBSD: linux_socket.c,v 1.145.4.4 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.145.4.3 2020/11/08 08:39:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.145.4.4 2022/08/03 11:11:32 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -440,6 +440,7 @@ linux_sys_sendto(struct lwp *l, const struct linux_sys_sendto_args *uap, registe
static void
linux_to_bsd_msghdr(const struct linux_msghdr *lmsg, struct msghdr *bmsg)
{
+ memset(bmsg, 0, sizeof(*bmsg));
bmsg->msg_name = lmsg->msg_name;
bmsg->msg_namelen = lmsg->msg_namelen;
bmsg->msg_iov = lmsg->msg_iov;
@@ -452,6 +453,7 @@ linux_to_bsd_msghdr(const struct linux_msghdr *lmsg, struct msghdr *bmsg)
static void
bsd_to_linux_msghdr(const struct msghdr *bmsg, struct linux_msghdr *lmsg)
{
+ memset(lmsg, 0, sizeof(*lmsg));
lmsg->msg_name = bmsg->msg_name;
lmsg->msg_namelen = bmsg->msg_namelen;
lmsg->msg_iov = bmsg->msg_iov;
@@ -699,6 +701,7 @@ linux_copyout_msg_control(struct lwp *l, struct msghdr *mp, struct mbuf *control
* 1. different values for level/type on some archs
* 2. different alignment of CMSG_DATA on some archs
*/
+ memset(&linux_cmsg, 0, sizeof(linux_cmsg));
linux_cmsg.cmsg_len = cmsg->cmsg_len - LINUX_CMSG_ALIGN_DELTA;
linux_cmsg.cmsg_level = cmsg->cmsg_level;
linux_cmsg.cmsg_type = cmsg->cmsg_type;
diff --git a/sys/compat/linux/common/linux_time.c b/sys/compat/linux/common/linux_time.c
index 7d689ff76a9..74cfc84d69d 100644
--- a/sys/compat/linux/common/linux_time.c
+++ b/sys/compat/linux/common/linux_time.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_time.c,v 1.39 2017/07/29 02:31:22 riastradh Exp $ */
+/* $NetBSD: linux_time.c,v 1.39.8.1 2022/08/03 11:11:32 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.39 2017/07/29 02:31:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.39.8.1 2022/08/03 11:11:32 martin Exp $");
#include <sys/param.h>
#include <sys/ucred.h>
@@ -117,6 +117,7 @@ linux_sys_settimeofday(struct lwp *l, const struct linux_sys_settimeofday_args *
void
native_to_linux_timespec(struct linux_timespec *ltp, struct timespec *ntp)
{
+ memset(ltp, 0, sizeof(*ltp));
ltp->tv_sec = ntp->tv_sec;
ltp->tv_nsec = ntp->tv_nsec;
}
@@ -124,6 +125,7 @@ native_to_linux_timespec(struct linux_timespec *ltp, struct timespec *ntp)
void
linux_to_native_timespec(struct timespec *ntp, struct linux_timespec *ltp)
{
+ memset(ntp, 0, sizeof(*ntp));
ntp->tv_sec = ltp->tv_sec;
ntp->tv_nsec = ltp->tv_nsec;
}