powerpc/nvram: Fix a memory leak in err path
authorPan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Wed, 9 Dec 2015 10:00:53 +0000 (18:00 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 20 Sep 2016 06:15:33 +0000 (16:15 +1000)
commit0d0fecc5b5bfddb0e67bef985cdeda2eac7ad6d8
treef0cde1a3c27e0f6b43e22e2e86135d50655fff6c
parent49d09bf2a66f4b5a6eabefb0d4c0f03f21810553
powerpc/nvram: Fix a memory leak in err path

If kmemdup fails, We need kfree *buff* first then return -ENOMEM.
Otherwise there is a memory leak.

Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/nvram_64.c