]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 17 Oct 2022 09:56:06 +0000 (11:56 +0200)
commit529df72f99906c448dc1f87e38a14598ecbfc90d
treeacca0917e49865a8d7da547400a82fa31b54cb5d
parent082891e8f5baec1fb7ceee24fa71640dcc2c0244
wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c()

BugLink: https://bugs.launchpad.net/bugs/1990162
[ Upstream commit b88d28146c30a8e14f0f012d56ebf19b68a348f4 ]

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: 610247f46feb ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/wireless/realtek/rtlwifi/debug.c