misc: pci_endpoint_test: fix return value of error branch
authorXiongfeng Wang <wangxiongfeng2@huawei.com>
Thu, 19 Nov 2020 12:49:18 +0000 (20:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:45 +0000 (11:53 +0100)
commit096ee6ebd01e81305e6646b27d5ec238cbaa963d
treef000d1c1b3871b9d41734987c6549821af48bad0
parent70f87d48bf565497f61dfc911b78311026424894
misc: pci_endpoint_test: fix return value of error branch

[ Upstream commit 1749c90489f2afa6b59dbf3ab59d58a9014c84a1 ]

We return 'err' in the error branch, but this variable may be set as
zero before. Fix it by setting 'err' as a negative value before we
goto the error label.

Fixes: e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Link: https://lore.kernel.org/r/1605790158-6780-1-git-send-email-wangxiongfeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/pci_endpoint_test.c