Message ID | 20180903144711.31585-20-jens.wiklander@linaro.org |
---|---|
State | New |
Headers | show |
Series | AVB using OP-TEE | expand |
Hi Jens, On 3 September 2018 at 16:47, Jens Wiklander <jens.wiklander@linaro.org> wrote: > With CONFIG_SANDBOX malloc a buffer in get_sector_buf() and return that > instead of returning CONFIG_FASTBOOT_BUF_ADDR since there's no such > buffer reserved. > > Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> > --- > include/avb_verify.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/avb_verify.h b/include/avb_verify.h > index a532a2331aea..7b95409d247e 100644 > --- a/include/avb_verify.h > +++ b/include/avb_verify.h > @@ -76,7 +76,16 @@ static inline size_t get_sector_buf_size(void) > > static inline void *get_sector_buf(void) > { > +#ifdef CONFIG_SANDBOX > + static void *p; > + > + if (!p) > + p = avb_malloc_(get_sector_buf_size()); > + > + return p; > +#else > return (void *)CONFIG_FASTBOOT_BUF_ADDR; Can you not define this on sandbox? We don't want sandbox to have special-case code if we can avoid it. If you do define it, you should change the code to: return map_sysmem(CONFIG_..., size); which works on sandbox and other archs too. > +#endif > } > > static inline bool is_buf_unaligned(void *buffer) > -- > 2.17.1 > Regards, Simon
Hi Simon, On Fri, Sep 14, 2018 at 12:54 PM, Simon Glass <sjg@chromium.org> wrote: > Hi Jens, > > On 3 September 2018 at 16:47, Jens Wiklander <jens.wiklander@linaro.org> wrote: >> With CONFIG_SANDBOX malloc a buffer in get_sector_buf() and return that >> instead of returning CONFIG_FASTBOOT_BUF_ADDR since there's no such >> buffer reserved. >> >> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> >> --- >> include/avb_verify.h | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/include/avb_verify.h b/include/avb_verify.h >> index a532a2331aea..7b95409d247e 100644 >> --- a/include/avb_verify.h >> +++ b/include/avb_verify.h >> @@ -76,7 +76,16 @@ static inline size_t get_sector_buf_size(void) >> >> static inline void *get_sector_buf(void) >> { >> +#ifdef CONFIG_SANDBOX >> + static void *p; >> + >> + if (!p) >> + p = avb_malloc_(get_sector_buf_size()); >> + >> + return p; >> +#else >> return (void *)CONFIG_FASTBOOT_BUF_ADDR; > > Can you not define this on sandbox? We don't want sandbox to have > special-case code if we can avoid it. > > If you do define it, you should change the code to: > > return map_sysmem(CONFIG_..., size); > > which works on sandbox and other archs too. Thanks, I'll use that. -- Jens
diff --git a/include/avb_verify.h b/include/avb_verify.h index a532a2331aea..7b95409d247e 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -76,7 +76,16 @@ static inline size_t get_sector_buf_size(void) static inline void *get_sector_buf(void) { +#ifdef CONFIG_SANDBOX + static void *p; + + if (!p) + p = avb_malloc_(get_sector_buf_size()); + + return p; +#else return (void *)CONFIG_FASTBOOT_BUF_ADDR; +#endif } static inline bool is_buf_unaligned(void *buffer)
With CONFIG_SANDBOX malloc a buffer in get_sector_buf() and return that instead of returning CONFIG_FASTBOOT_BUF_ADDR since there's no such buffer reserved. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> --- include/avb_verify.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1