[XEN PATCH] xen/libelf: address violations of MISRA C:2012 RUles 8.2 and 8.3

Federico Serafini posted 1 patch 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/e4d28b9b78e84260feea6bdbcb4ecdd815af5db3.1694591513.git.federico.serafini@bugseng.com
xen/include/xen/libelf.h | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
[XEN PATCH] xen/libelf: address violations of MISRA C:2012 RUles 8.2 and 8.3
Posted by Federico Serafini 9 months, 2 weeks ago
Add missing parameter names and make function declarations and
definitions consistent. No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/include/xen/libelf.h | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h
index be47b0cc36..1c77e3df31 100644
--- a/xen/include/xen/libelf.h
+++ b/xen/include/xen/libelf.h
@@ -260,8 +260,8 @@ struct elf_binary {
    * str should be a HANDLE.
    */
 
-uint64_t elf_access_unsigned(struct elf_binary *elf, elf_ptrval ptr,
-                             uint64_t offset, size_t size);
+uint64_t elf_access_unsigned(struct elf_binary *elf, elf_ptrval base,
+                             uint64_t moreoffset, size_t size);
   /* Reads a field at arbitrary offset and alignemnt */
 
 uint64_t elf_round_up(struct elf_binary *elf, uint64_t addr);
@@ -272,8 +272,10 @@ const char *elf_strval(struct elf_binary *elf, elf_ptrval start);
 const char *elf_strfmt(struct elf_binary *elf, elf_ptrval start);
   /* like elf_strval but returns "(invalid)" instead of NULL */
 
-void elf_memcpy_safe(struct elf_binary*, elf_ptrval dst, elf_ptrval src, size_t);
-void elf_memset_safe(struct elf_binary*, elf_ptrval dst, int c, size_t);
+void elf_memcpy_safe(struct elf_binary *elf, elf_ptrval dst, elf_ptrval src,
+                     size_t size);
+void elf_memset_safe(struct elf_binary *elf, elf_ptrval dst, int c,
+                     size_t size);
   /*
    * Versions of memcpy and memset which arrange never to write
    * outside permitted areas.
@@ -324,7 +326,8 @@ ELF_HANDLE_DECL(elf_sym) elf_sym_by_index(struct elf_binary *elf, unsigned index
 const char *elf_note_name(struct elf_binary *elf, ELF_HANDLE_DECL(elf_note) note); /* may return NULL */
 elf_ptrval elf_note_desc(struct elf_binary *elf, ELF_HANDLE_DECL(elf_note) note);
 uint64_t elf_note_numeric(struct elf_binary *elf, ELF_HANDLE_DECL(elf_note) note);
-uint64_t elf_note_numeric_array(struct elf_binary *, ELF_HANDLE_DECL(elf_note),
+uint64_t elf_note_numeric_array(struct elf_binary *elf,
+                                ELF_HANDLE_DECL(elf_note) note,
                                 unsigned int unitsz, unsigned int idx);
 
 /*
@@ -346,9 +349,10 @@ bool elf_phdr_is_loadable(struct elf_binary *elf, ELF_HANDLE_DECL(elf_phdr) phdr
 /* ------------------------------------------------------------------------ */
 /* xc_libelf_loader.c                                                       */
 
-elf_errorstatus elf_init(struct elf_binary *elf, const char *image, size_t size);
+elf_errorstatus elf_init(struct elf_binary *elf, const char *image_input,
+                         size_t size);
   /*
-   * image and size must be correct.  They will be recorded in
+   * image_input and size must be correct.  They will be recorded in
    * *elf, and must remain valid while the elf is in use.
    */
 #ifdef __XEN__
@@ -445,16 +449,16 @@ static inline int elf_xen_feature_get(int nr, uint32_t * addr)
     return !!(addr[nr >> 5] & (1 << (nr & 31)));
 }
 
-int elf_xen_parse_features(const char *features,
-                           uint32_t *supported,
-                           uint32_t *required);
-int elf_xen_parse_note(struct elf_binary *elf,
-                       struct elf_dom_parms *parms,
-                       ELF_HANDLE_DECL(elf_note) note);
-int elf_xen_parse_guest_info(struct elf_binary *elf,
-                             struct elf_dom_parms *parms);
-int elf_xen_parse(struct elf_binary *elf,
-                  struct elf_dom_parms *parms, bool hvm);
+elf_errorstatus elf_xen_parse_features(const char *features,
+                                       uint32_t *supported,
+                                       uint32_t *required);
+elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,
+                                   struct elf_dom_parms *parms,
+                                   ELF_HANDLE_DECL(elf_note) note);
+elf_errorstatus elf_xen_parse_guest_info(struct elf_binary *elf,
+                                         struct elf_dom_parms *parms);
+elf_errorstatus elf_xen_parse(struct elf_binary *elf,
+                              struct elf_dom_parms *parms, bool hvm);
 
 static inline void *elf_memcpy_unchecked(void *dest, const void *src, size_t n)
     { return memcpy(dest, src, n); }
-- 
2.34.1
Re: [XEN PATCH] xen/libelf: address violations of MISRA C:2012 RUles 8.2 and 8.3
Posted by Federico Serafini 9 months, 2 weeks ago
On 13/09/23 14:29, Federico Serafini wrote:
> Add missing parameter names and make function declarations and
> definitions consistent. No functional change.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

There is a typo in the patch title (RUles), please correct on commit.

Reviewed-by: Federico Serafini <federico.serafini@bugseng.com>
Re: [XEN PATCH] xen/libelf: address violations of MISRA C:2012 RUles 8.2 and 8.3
Posted by Julien Grall 9 months, 2 weeks ago
Hi,

On 13/09/2023 13:41, Federico Serafini wrote:
> On 13/09/23 14:29, Federico Serafini wrote:
>> Add missing parameter names and make function declarations and
>> definitions consistent. No functional change.
>>
>> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> There is a typo in the patch title (RUles), please correct on commit.

That can be done so long there are no other comments.

> 
> Reviewed-by: Federico Serafini <federico.serafini@bugseng.com>

I am bit confused. Why do you provide a reviewed-by on a patch you wrote?

Cheers,

-- 
Julien Grall
Re: [XEN PATCH] xen/libelf: address violations of MISRA C:2012 RUles 8.2 and 8.3
Posted by Federico Serafini 9 months, 2 weeks ago
On 13/09/23 15:14, Julien Grall wrote:
> Hi,
> 
> On 13/09/2023 13:41, Federico Serafini wrote:
>> On 13/09/23 14:29, Federico Serafini wrote:
>>> Add missing parameter names and make function declarations and
>>> definitions consistent. No functional change.
>>>
>>> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
>>
>> There is a typo in the patch title (RUles), please correct on commit.
> 
> That can be done so long there are no other comments.
> 
>>
>> Reviewed-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> I am bit confused. Why do you provide a reviewed-by on a patch you wrote?
> 
> Cheers,
> 
Since I noticed something wrong with my patch, I thought that adding the
"Reviewed-by" might be better than simply replying to the mail.
I will not do it again.

-- 
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)
Re: [XEN PATCH] xen/libelf: address violations of MISRA C:2012 RUles 8.2 and 8.3
Posted by Stefano Stabellini 9 months, 2 weeks ago
On Wed, 13 Sep 2023, Julien Grall wrote:
> On 13/09/2023 13:41, Federico Serafini wrote:
> > On 13/09/23 14:29, Federico Serafini wrote:
> > > Add missing parameter names and make function declarations and
> > > definitions consistent. No functional change.
> > > 
> > > Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> > 
> > There is a typo in the patch title (RUles), please correct on commit.
> 
> That can be done so long there are no other comments.
> 
> > 
> > Reviewed-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> I am bit confused. Why do you provide a reviewed-by on a patch you wrote?

Maybe a mistake?

In any case, I reviewed the patch and everything checks out

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>