Merge branch 'for-6.1/core' into for-linus
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 5 Oct 2022 09:19:06 +0000 (10:19 +0100)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 5 Oct 2022 09:19:06 +0000 (10:19 +0100)
- move from strlcpy with unused retval to strscpy (Wolfram Sang)
- Kconfig fixes (Randy Dunlap)
- HID-BPF preparatory patches, convert blank defines as enums (Benjamin
  Tissoires)

1  2 
drivers/hid/hid-steam.c

diff --combined drivers/hid/hid-steam.c
index fc616db4231bb19adc5e39b9fbcc042d23967738,f675e1aa08c96cd0bc4e324132b0315db6c19b03..8ee43cb225fce10dd1129df6e3a45de5dc84f945
@@@ -134,11 -134,6 +134,11 @@@ static int steam_recv_report(struct ste
        int ret;
  
        r = steam->hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0];
 +      if (!r) {
 +              hid_err(steam->hdev, "No HID_FEATURE_REPORT submitted -  nothing to read\n");
 +              return -EINVAL;
 +      }
 +
        if (hid_report_len(r) < 64)
                return -EINVAL;
  
@@@ -170,11 -165,6 +170,11 @@@ static int steam_send_report(struct ste
        int ret;
  
        r = steam->hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0];
 +      if (!r) {
 +              hid_err(steam->hdev, "No HID_FEATURE_REPORT submitted -  nothing to read\n");
 +              return -EINVAL;
 +      }
 +
        if (hid_report_len(r) < 64)
                return -EINVAL;
  
@@@ -256,7 -246,7 +256,7 @@@ static int steam_get_serial(struct stea
        if (reply[0] != 0xae || reply[1] != 0x15 || reply[2] != 0x01)
                return -EIO;
        reply[3 + STEAM_SERIAL_LEN] = 0;
-       strlcpy(steam->serial_no, reply + 3, sizeof(steam->serial_no));
+       strscpy(steam->serial_no, reply + 3, sizeof(steam->serial_no));
        return 0;
  }
  
@@@ -524,7 -514,7 +524,7 @@@ static int steam_register(struct steam_
                 */
                mutex_lock(&steam->mutex);
                if (steam_get_serial(steam) < 0)
-                       strlcpy(steam->serial_no, "XXXXXXXXXX",
+                       strscpy(steam->serial_no, "XXXXXXXXXX",
                                        sizeof(steam->serial_no));
                mutex_unlock(&steam->mutex);
  
@@@ -699,9 -689,9 +699,9 @@@ static struct hid_device *steam_create_
        client_hdev->version = hdev->version;
        client_hdev->type = hdev->type;
        client_hdev->country = hdev->country;
-       strlcpy(client_hdev->name, hdev->name,
+       strscpy(client_hdev->name, hdev->name,
                        sizeof(client_hdev->name));
-       strlcpy(client_hdev->phys, hdev->phys,
+       strscpy(client_hdev->phys, hdev->phys,
                        sizeof(client_hdev->phys));
        /*
         * Since we use the same device info than the real interface to