Re: [PATCH v2 01/10] binfmt_flat: assorted cleanups

From: Greg Ungerer
Date: Tue Jul 19 2016 - 01:01:15 EST


Hi Nicolas,

On 18/07/16 13:31, Nicolas Pitre wrote:
> Remove excessive casts, do some code grouping, etc.
> No functional changes.
>
> Signed-off-by: Nicolas Pitre <nico@xxxxxxxxxx>
> ---
> fs/binfmt_flat.c | 118 ++++++++++++++++++++++++++-----------------------------
> 1 file changed, 56 insertions(+), 62 deletions(-)
>
> diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
> index caf9e39bb8..085059d879 100644
> --- a/fs/binfmt_flat.c
> +++ b/fs/binfmt_flat.c
> @@ -80,7 +80,7 @@ struct lib_info {
> unsigned long text_len; /* Length of text segment */
> unsigned long entry; /* Start address for this module */
> unsigned long build_date; /* When this one was compiled */
> - short loaded; /* Has this library been loaded? */
> + bool loaded; /* Has this library been loaded? */
> } lib_list[MAX_SHARED_LIBS];
> };
>
> @@ -107,7 +107,7 @@ static struct linux_binfmt flat_format = {
> static int flat_core_dump(struct coredump_params *cprm)
> {
> printk("Process %s:%d received signr %d and should have core dumped\n",
> - current->comm, current->pid, (int) cprm->siginfo->si_signo);
> + current->comm, current->pid, cprm->siginfo->si_signo);
> return(1);
> }
>
> @@ -190,7 +190,7 @@ static int decompress_exec(
> loff_t fpos;
> int ret, retval;
>
> - DBG_FLT("decompress_exec(offset=%x,buf=%x,len=%x)\n",(int)offset, (int)dst, (int)len);
> + DBG_FLT("decompress_exec(offset=%lx,buf=%p,len=%lx)\n",offset, dst, len);
>
> memset(&strm, 0, sizeof(strm));
> strm.workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
> @@ -358,8 +358,8 @@ calc_reloc(unsigned long r, struct lib_info *p, int curid, int internalp)
> text_len = p->lib_list[id].text_len;
>
> if (!flat_reloc_valid(r, start_brk - start_data + text_len)) {
> - printk("BINFMT_FLAT: reloc outside program 0x%x (0 - 0x%x/0x%x)",
> - (int) r,(int)(start_brk-start_data+text_len),(int)text_len);
> + printk("BINFMT_FLAT: reloc outside program 0x%lx (0 - 0x%lx/0x%lx)",
> + r, start_brk-start_data+text_len, text_len);

Seeing as you have modified quite a few printk calls is it worth
while annotating them with appropriate KERN_ERR, KERN_INFO, etc?
Just a thought.

Regards
Greg