* [PATCH] image.h: make image_sign_info.fit point to const
@ 2021-10-18 5:49 Hannu Lounento
2021-10-29 1:16 ` Simon Glass
2021-10-31 12:57 ` Simon Glass
0 siblings, 2 replies; 3+ messages in thread
From: Hannu Lounento @ 2021-10-18 5:49 UTC (permalink / raw)
To: u-boot; +Cc: sjg, Hannu Lounento
The data blob apparently does not need to be modified through the fit
field of the image_sign_info struct so make it point to const to avoid
the need to cast away constness in functions that assign a pointer to
const data to the field.
fit_image_setup_verify already had to cast away constness as it assigned
a const void * argument to the field. The cast can now be removed.
Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>
---
common/image-fit-sig.c | 2 +-
include/image.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c
index 4edebbf2d32..63e5423c925 100644
--- a/common/image-fit-sig.c
+++ b/common/image-fit-sig.c
@@ -85,7 +85,7 @@ static int fit_image_setup_verify(struct image_sign_info *info,
memset(info, '\0', sizeof(*info));
info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
- info->fit = (void *)fit;
+ info->fit = fit;
info->node_offset = noffset;
info->name = algo_name;
info->checksum = image_get_checksum_algo(algo_name);
diff --git a/include/image.h b/include/image.h
index 34d13ada84b..fd662e74b41 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1159,7 +1159,7 @@ struct image_sign_info {
const char *keydir; /* Directory conaining keys */
const char *keyname; /* Name of key to use */
const char *keyfile; /* Filename of private or public key */
- void *fit; /* Pointer to FIT blob */
+ const void *fit; /* Pointer to FIT blob */
int node_offset; /* Offset of signature node */
const char *name; /* Algorithm name */
struct checksum_algo *checksum; /* Checksum algorithm information */
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] image.h: make image_sign_info.fit point to const
2021-10-18 5:49 [PATCH] image.h: make image_sign_info.fit point to const Hannu Lounento
@ 2021-10-29 1:16 ` Simon Glass
2021-10-31 12:57 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-10-29 1:16 UTC (permalink / raw)
To: Hannu Lounento; +Cc: u-boot
On Sun, 17 Oct 2021 at 23:49, Hannu Lounento <hannu.lounento@vaisala.com> wrote:
>
> The data blob apparently does not need to be modified through the fit
> field of the image_sign_info struct so make it point to const to avoid
> the need to cast away constness in functions that assign a pointer to
> const data to the field.
>
> fit_image_setup_verify already had to cast away constness as it assigned
> a const void * argument to the field. The cast can now be removed.
>
> Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>
> ---
> common/image-fit-sig.c | 2 +-
> include/image.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] image.h: make image_sign_info.fit point to const
2021-10-18 5:49 [PATCH] image.h: make image_sign_info.fit point to const Hannu Lounento
2021-10-29 1:16 ` Simon Glass
@ 2021-10-31 12:57 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-10-31 12:57 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, Hannu Lounento
On Sun, 17 Oct 2021 at 23:49, Hannu Lounento <hannu.lounento@vaisala.com> wrote:
>
> The data blob apparently does not need to be modified through the fit
> field of the image_sign_info struct so make it point to const to avoid
> the need to cast away constness in functions that assign a pointer to
> const data to the field.
>
> fit_image_setup_verify already had to cast away constness as it assigned
> a const void * argument to the field. The cast can now be removed.
>
> Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>
> ---
> common/image-fit-sig.c | 2 +-
> include/image.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-31 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 5:49 [PATCH] image.h: make image_sign_info.fit point to const Hannu Lounento
2021-10-29 1:16 ` Simon Glass
2021-10-31 12:57 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).