linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/binfmt_elf: remove the same condition check
@ 2018-08-02  2:00 zhong jiang
  2018-08-02  2:34 ` Matthew Wilcox
  2018-08-02  3:04 ` Al Viro
  0 siblings, 2 replies; 5+ messages in thread
From: zhong jiang @ 2018-08-02  2:00 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, linux-kernel

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(-)

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs/binfmt_elf: remove the same condition check
  2018-08-02  2:00 [PATCH] fs/binfmt_elf: remove the same condition check zhong jiang
@ 2018-08-02  2:34 ` Matthew Wilcox
  2018-08-02  3:24   ` zhong jiang
  2018-08-02  3:04 ` Al Viro
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2018-08-02  2:34 UTC (permalink / raw)
  To: zhong jiang; +Cc: viro, linux-fsdevel, linux-kernel

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).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs/binfmt_elf: remove the same condition check
  2018-08-02  2:00 [PATCH] fs/binfmt_elf: remove the same condition check zhong jiang
  2018-08-02  2:34 ` Matthew Wilcox
@ 2018-08-02  3:04 ` Al Viro
  2018-08-02  3:56   ` zhong jiang
  1 sibling, 1 reply; 5+ messages in thread
From: Al Viro @ 2018-08-02  3:04 UTC (permalink / raw)
  To: zhong jiang; +Cc: linux-fsdevel, linux-kernel

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs/binfmt_elf: remove the same condition check
  2018-08-02  2:34 ` Matthew Wilcox
@ 2018-08-02  3:24   ` zhong jiang
  0 siblings, 0 replies; 5+ messages in thread
From: zhong jiang @ 2018-08-02  3:24 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: viro, linux-fsdevel, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs/binfmt_elf: remove the same condition check
  2018-08-02  3:04 ` Al Viro
@ 2018-08-02  3:56   ` zhong jiang
  0 siblings, 0 replies; 5+ messages in thread
From: zhong jiang @ 2018-08-02  3:56 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel

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
>>
> .
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-02  5:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02  2:00 [PATCH] fs/binfmt_elf: remove the same condition check zhong jiang
2018-08-02  2:34 ` Matthew Wilcox
2018-08-02  3:24   ` zhong jiang
2018-08-02  3:04 ` Al Viro
2018-08-02  3:56   ` zhong jiang

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).