* [PATCH u-boot v2019.04-aspeed-openbmc] otp: Reduce size of struct otpkey
@ 2022-07-14 7:45 Joel Stanley
2022-07-16 9:08 ` Zev Weiss
0 siblings, 1 reply; 2+ messages in thread
From: Joel Stanley @ 2022-07-14 7:45 UTC (permalink / raw)
To: openbmc, Cédric Le Goater
Don't store more information than is used.
Function old new delta
_otp_print_key 540 580 +40
otp_verify_boot_image 1336 1328 -8
a2_key_type 640 40 -600
a1_key_type 640 40 -600
a3_key_type 1024 64 -960
a0_key_type 1024 64 -960
Total: Before=279318, After=276230, chg -1.11%
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
cmd/otp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cmd/otp.c b/cmd/otp.c
index 049c217d6048..6dd2d2bdfb17 100644
--- a/cmd/otp.c
+++ b/cmd/otp.c
@@ -133,11 +133,11 @@ struct otpstrap_status {
};
struct otpkey_type {
- int value;
- int key_type;
- int order;
- int need_id;
- char information[110];
+ int value: 4;
+ int key_type: 4;
+ int order: 1;
+ int need_id: 1;
+ char *information;
};
struct otp_pro_sts {
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH u-boot v2019.04-aspeed-openbmc] otp: Reduce size of struct otpkey
2022-07-14 7:45 [PATCH u-boot v2019.04-aspeed-openbmc] otp: Reduce size of struct otpkey Joel Stanley
@ 2022-07-16 9:08 ` Zev Weiss
0 siblings, 0 replies; 2+ messages in thread
From: Zev Weiss @ 2022-07-16 9:08 UTC (permalink / raw)
To: Joel Stanley; +Cc: openbmc@lists.ozlabs.org, Cédric Le Goater
On Thu, Jul 14, 2022 at 12:45:52AM PDT, Joel Stanley wrote:
>Don't store more information than is used.
>
> Function old new delta
> _otp_print_key 540 580 +40
> otp_verify_boot_image 1336 1328 -8
> a2_key_type 640 40 -600
> a1_key_type 640 40 -600
> a3_key_type 1024 64 -960
> a0_key_type 1024 64 -960
> Total: Before=279318, After=276230, chg -1.11%
>
>Signed-off-by: Joel Stanley <joel@jms.id.au>
>---
> cmd/otp.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/cmd/otp.c b/cmd/otp.c
>index 049c217d6048..6dd2d2bdfb17 100644
>--- a/cmd/otp.c
>+++ b/cmd/otp.c
>@@ -133,11 +133,11 @@ struct otpstrap_status {
> };
>
> struct otpkey_type {
>- int value;
>- int key_type;
>- int order;
>- int need_id;
>- char information[110];
>+ int value: 4;
>+ int key_type: 4;
>+ int order: 1;
>+ int need_id: 1;
I'm not sure if there's any chance it could lead to any actual problems
here, but I think some static analyzers get unhappy about single-bit
signed bitfields...perhaps these (maybe all four?) should be unsigned
instead?
>+ char *information;
> };
>
> struct otp_pro_sts {
>--
>2.35.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-16 9:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-14 7:45 [PATCH u-boot v2019.04-aspeed-openbmc] otp: Reduce size of struct otpkey Joel Stanley
2022-07-16 9:08 ` Zev Weiss
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.