various coverity-inspired fixes

. some strncpy/strcpy to strlcpy conversions
	. new <minix/param.h> to avoid including other minix headers
	  that have colliding definitions with library and commands code,
	  causing parse warnings
	. removed some dead code / assignments
This commit is contained in:
Ben Gras
2012-07-16 13:17:11 +02:00
parent 77dbd766c1
commit cbcdb838f1
26 changed files with 89 additions and 80 deletions

View File

@@ -746,7 +746,7 @@ void memory_init(void)
void arch_proc_init(struct proc *pr, const u32_t ip, const u32_t sp, char *name)
{
arch_proc_reset(pr);
strcpy(pr->p_name, name);
strlcpy(pr->p_name, name, sizeof(pr->p_name));
/* set custom state we know */
pr->p_reg.pc = ip;

View File

@@ -1,15 +1,13 @@
#include <minix/cpufeature.h>
#include <minix/type.h>
#include <libexec.h>
#include <assert.h>
#include "kernel.h"
#include <libexec.h>
#include "arch_proto.h"
#include <string.h>
#include <libexec.h>
#include <minix/type.h>
/* These are set/computed in kernel.lds. */
extern char _kern_vir_base, _kern_phys_base, _kern_size;
@@ -174,11 +172,11 @@ void pg_identity(kinfo_t *cbi)
for(i = 0; i < I386_VM_DIR_ENTRIES; i++) {
u32_t flags = I386_VM_PRESENT | I386_VM_BIGPAGE |
I386_VM_USER | I386_VM_WRITE;
phys = i * I386_BIG_PAGE_SIZE;
if((cbi->mem_high_phys & I386_VM_ADDR_MASK_4MB)
<= (phys & I386_VM_ADDR_MASK_4MB)) {
flags |= I386_VM_PWT | I386_VM_PCD;
}
phys = i * I386_BIG_PAGE_SIZE;
pagedir[i] = phys | flags;
}
}

View File

@@ -364,7 +364,7 @@ void arch_boot_proc(struct boot_image *ip, struct proc *rp)
execi.proc_e = ip->endpoint;
execi.hdr = (char *) mod->mod_start; /* phys mem direct */
execi.hdr_len = mod->mod_end - mod->mod_start;
strcpy(execi.progname, ip->proc_name);
strlcpy(execi.progname, ip->proc_name, sizeof(execi.progname));
execi.frame_len = 0;
/* callbacks for use in the kernel */