]> git.baikalelectronics.ru Git - kernel.git/commit
wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 17 May 2022 11:48:44 +0000 (14:48 +0300)
committerKalle Valo <kvalo@kernel.org>
Mon, 30 May 2022 11:17:26 +0000 (14:17 +0300)
commit35cb5e2648a451063c96fa7a5d07b76f536d5ba5
treeb9f66765613d44372060821166570861116df871
parent226d9e48587423fe882cba86037249bd4865bb2a
wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c()

If the copy_from_user() fails or the user gives invalid date then the
correct thing to do is to return a negative error code.  (Currently it
returns success).

I made a copy additional related cleanups:
1) There is no need to check "buffer" for NULL.  That's handled by
copy_from_user().
2) The "h2c_len" variable cannot be negative because it is unsigned
and because sscanf() does not return negative error codes.

Fixes: cad581290f6d ("rtlwifi: Improve debugging by using debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/YoOLnDkHgVltyXK7@kili
drivers/net/wireless/realtek/rtlwifi/debug.c