[U-Boot] [PATCH 11/30] riscv: fix use of incorrectly sized variables

Auer, Lukas lukas.auer at aisec.fraunhofer.de
Thu Oct 25 11:47:35 UTC 2018


Hi Rick and Bin,

On Tue, 2018-10-23 at 13:52 +0800, Rick Chen wrote:
> > > -static void _exit_trap(int code, uint epc, struct pt_regs *regs)
> > > +static void _exit_trap(ulong code, ulong epc, struct pt_regs
> > > *regs)
> > >  {
> > >         static const char * const exception_code[] = {
> > >                 "Instruction address misaligned",
> > > @@ -70,6 +70,6 @@ static void _exit_trap(int code, uint epc,
> > > struct pt_regs
> > 
> > *regs)
> > >                 "Load address misaligned"
> > >         };
> > > 
> > > -       printf("exception code: %d , %s , epc %08x , ra %08lx\n",
> > > +       printf("exception code: %ld , %s , epc %016lx , ra
> > > %016lx\n",
> > 
> > We should not print 16 digits on a RV32 system.
> 
> Hi Lukas
> 
> Maybe you can try as below :
> 
> printf("exception code: %ld , %s , epc %p , ra %p\n",
>       code, exception_code[code], (void *)epc, (void *)regs->ra);
> 
> Rick
> 

Thanks, I will update the patch to use this format string in v2.

Thanks,
Lukas

> > 
> > >                 code, exception_code[code], epc, regs->ra);
> > >  }
> > > --
> > 
> > Others look good to me.
> > 
> > Regards,
> > Bin


More information about the U-Boot mailing list