bug fix: Multiplication result converted to larger type

This commit is contained in:
fslongjin 2022-05-21 21:57:00 +08:00
parent e6108602df
commit 1eb9a299b6

View File

@ -18,8 +18,6 @@ long process_global_pid = 1; // 系统中最大的pid
extern void system_call(void);
extern void kernel_thread_func(void);
ul _stack_start; // initial proc的栈基地址虚拟地址
struct mm_struct initial_mm = {0};
struct thread_struct initial_thread =
@ -400,11 +398,11 @@ static int process_load_elf_file(struct pt_regs *regs, char *path)
#endif
if (ehdr.e_type != ET_EXEC)
{
kdebug("ehdr->e_type=%d", ehdr.e_type);
kerror("Not executable file! filename=%s\tehdr->e_type=%d", path, ehdr.e_type);
retval = -EUNSUPPORTED;
goto load_elf_failed;
}
kdebug("e_entry=%#018lx", ehdr.e_entry);
kdebug("filename=%s:\te_entry=%#018lx", path, ehdr.e_entry);
regs->rip = ehdr.e_entry;
current_pcb->mm->code_addr_start = ehdr.e_entry;
@ -413,7 +411,7 @@ static int process_load_elf_file(struct pt_regs *regs, char *path)
pos = ehdr.e_phoff;
// 读取所有的phdr
pos = filp->file_ops->lseek(filp, pos, SEEK_SET);
filp->file_ops->read(filp, (char *)buf, ehdr.e_phentsize * ehdr.e_phnum, &pos);
filp->file_ops->read(filp, (char *)buf, (uint64_t)ehdr.e_phentsize * (uint64_t)ehdr.e_phnum, &pos);
if ((unsigned long)filp <= 0)
{
kdebug("(unsigned long)filp=%d", (long)filp);