staging: rtl8723bs: add missing range check on id

The value of the u8 id needs to be upper bounds checked to ensure
the cam_cache array on the adapter dvobj is not indexed outside
of the allowed range of 0..TOTAL_CAM_ENTRY-1. This can currently
occur if id is >= TOTAL_CAM_ENTRY when calling write_cam_from_cache.
Fix this by adding an upper range check.

Detected by CoverityScan, CID#1428464 ("Use of untrusted scalar value")

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Colin Ian King and committed by Greg Kroah-Hartman c51b46dd 974d4d03

+2
+2
drivers/staging/rtl8723bs/os_dep/rtw_proc.c
··· 311 311 312 312 if (num < 2) 313 313 return count; 314 + if (id >= TOTAL_CAM_ENTRY) 315 + return -EINVAL; 314 316 315 317 if (strcmp("c", cmd) == 0) { 316 318 _clear_cam_entry(adapter, id);