fs/binfmt_elf: remove the same condition check
diff mbox series

Message ID 1533175228-17547-1-git-send-email-zhongjiang@huawei.com
State New
Headers show
Series
  • fs/binfmt_elf: remove the same condition check
Related show

Commit Message

zhong jiang Aug. 2, 2018, 2 a.m. UTC
dump_align is used to double check in a expression. It is redundant.
so just remove one of them.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 fs/binfmt_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthew Wilcox Aug. 2, 2018, 2:34 a.m. UTC | #1
On Thu, Aug 02, 2018 at 10:00:28AM +0800, zhong jiang wrote:
> dump_align is used to double check in a expression. It is redundant.
> so just remove one of them.

You're wrong.  Functions in C can have side-effects (and this one does).
Al Viro Aug. 2, 2018, 3:04 a.m. UTC | #2
On Thu, Aug 02, 2018 at 10:00:28AM +0800, zhong jiang wrote:
> dump_align is used to double check in a expression. It is redundant.
> so just remove one of them.

<mode eliza>
What makes you think that it is redundant?
</mode>

> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  fs/binfmt_elf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index efae2fb..b6c5b02 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -1439,7 +1439,7 @@ static int writenote(struct memelfnote *men, struct coredump_params *cprm)
>  
>  	return dump_emit(cprm, &en, sizeof(en)) &&
>  	    dump_emit(cprm, men->name, en.n_namesz) && dump_align(cprm, 4) &&
> -	    dump_emit(cprm, men->data, men->datasz) && dump_align(cprm, 4);
> +	    dump_emit(cprm, men->data, men->datasz);
>  }
>  
>  static void fill_elf_header(struct elfhdr *elf, int segs,
> -- 
> 1.7.12.4
>
zhong jiang Aug. 2, 2018, 3:24 a.m. UTC | #3
On 2018/8/2 10:34, Matthew Wilcox wrote:
> On Thu, Aug 02, 2018 at 10:00:28AM +0800, zhong jiang wrote:
>> dump_align is used to double check in a expression. It is redundant.
>> so just remove one of them.
> You're wrong.  Functions in C can have side-effects (and this one does).
>
>
Ok,  I miss that.  Thank you for clarification.

Thanks,
zhong jiang
zhong jiang Aug. 2, 2018, 3:56 a.m. UTC | #4
On 2018/8/2 11:04, Al Viro wrote:
> On Thu, Aug 02, 2018 at 10:00:28AM +0800, zhong jiang wrote:
>> dump_align is used to double check in a expression. It is redundant.
>> so just remove one of them.
> <mode eliza>
> What makes you think that it is redundant?
> </mode>
  I am sorry for that.  Maybe I miss something.

 Thanks
 zhong jiang
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  fs/binfmt_elf.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
>> index efae2fb..b6c5b02 100644
>> --- a/fs/binfmt_elf.c
>> +++ b/fs/binfmt_elf.c
>> @@ -1439,7 +1439,7 @@ static int writenote(struct memelfnote *men, struct coredump_params *cprm)
>>  
>>  	return dump_emit(cprm, &en, sizeof(en)) &&
>>  	    dump_emit(cprm, men->name, en.n_namesz) && dump_align(cprm, 4) &&
>> -	    dump_emit(cprm, men->data, men->datasz) && dump_align(cprm, 4);
>> +	    dump_emit(cprm, men->data, men->datasz);
>>  }
>>  
>>  static void fill_elf_header(struct elfhdr *elf, int segs,
>> -- 
>> 1.7.12.4
>>
> .
>

Patch
diff mbox series

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index efae2fb..b6c5b02 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1439,7 +1439,7 @@  static int writenote(struct memelfnote *men, struct coredump_params *cprm)
 
 	return dump_emit(cprm, &en, sizeof(en)) &&
 	    dump_emit(cprm, men->name, en.n_namesz) && dump_align(cprm, 4) &&
-	    dump_emit(cprm, men->data, men->datasz) && dump_align(cprm, 4);
+	    dump_emit(cprm, men->data, men->datasz);
 }
 
 static void fill_elf_header(struct elfhdr *elf, int segs,