powerpc/nvram: Fix an incorrect partition merge
authorPan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Thu, 10 Dec 2015 07:30:02 +0000 (15:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 31 Oct 2016 10:14:01 +0000 (04:14 -0600)
commitcccc670b51375081667db9d0d516818c5cddfe02
tree5b86d46332616e7a8c1690555914fb8f16115832
parent2577121578e1857f6438d182ffa1f34d5c9cc8c8
powerpc/nvram: Fix an incorrect partition merge

commit 11b7e154b132232535befe51c55db048069c8461 upstream.

When we merge two contiguous partitions whose signatures are marked
NVRAM_SIG_FREE, We need update prev's length and checksum, then write it
to nvram, not cur's. So lets fix this mistake now.

Also use memset instead of strncpy to set the partition's name. It's
more readable if we want to fill up with duplicate chars .

Fixes: fa2b4e54d41f ("powerpc/nvram: Improve partition removal")
Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/nvram_64.c