hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/net/wireless/realtek/rtlwifi/debug.c
....@@ -278,8 +278,8 @@
278278
279279 tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
280280
281
- if (!buffer || copy_from_user(tmp, buffer, tmp_len))
282
- return count;
281
+ if (copy_from_user(tmp, buffer, tmp_len))
282
+ return -EFAULT;
283283
284284 tmp[tmp_len] = '\0';
285285
....@@ -287,7 +287,7 @@
287287 num = sscanf(tmp, "%x %x %x", &addr, &val, &len);
288288
289289 if (num != 3)
290
- return count;
290
+ return -EINVAL;
291291
292292 switch (len) {
293293 case 1:
....@@ -375,8 +375,8 @@
375375
376376 tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
377377
378
- if (!buffer || copy_from_user(tmp, buffer, tmp_len))
379
- return count;
378
+ if (copy_from_user(tmp, buffer, tmp_len))
379
+ return -EFAULT;
380380
381381 tmp[tmp_len] = '\0';
382382
....@@ -386,7 +386,7 @@
386386 if (num != 4) {
387387 rtl_dbg(rtlpriv, COMP_ERR, DBG_DMESG,
388388 "Format is <path> <addr> <mask> <data>\n");
389
- return count;
389
+ return -EINVAL;
390390 }
391391
392392 rtl_set_rfreg(hw, path, addr, bitmask, data);