diff mbox series

fs/binfmt_elf_fdpic: remove redundant condition check in writenote

Message ID 1533175474-17785-1-git-send-email-zhongjiang@huawei.com (mailing list archive)
State New, archived
Headers show
Series fs/binfmt_elf_fdpic: remove redundant condition check in writenote | expand

Commit Message

zhong jiang Aug. 2, 2018, 2:04 a.m. UTC
It is unncessary to use double test for a expression. so just
remove one of them.

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

Comments

zhong jiang Aug. 2, 2018, 2:51 a.m. UTC | #1
plese ingore  it. 
On 2018/8/2 10:04, zhong jiang wrote:
> It is unncessary to use double test for a expression. so just
> remove one of them.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  fs/binfmt_elf_fdpic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index b53bb37..5162372 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -1288,7 +1288,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 inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs)
Al Viro Aug. 2, 2018, 3:05 a.m. UTC | #2
On Thu, Aug 02, 2018 at 10:04:34AM +0800, zhong jiang wrote:
> It is unncessary to use double test for a expression. so just
> remove one of them.

... except when something in that expression might have side effects,
that is.
diff mbox series

Patch

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index b53bb37..5162372 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1288,7 +1288,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 inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs)