diff options
| author | hathach <[email protected]> | 2025-10-16 10:44:22 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-10-16 10:44:22 +0700 |
| commit | 2f3b21a1e58e5c03c61e83920d77f8c27540dfd5 (patch) | |
| tree | 396d211424948c0a6ba4c6301f593ab9635fd4f9 /examples/device/msc_dual_lun/src | |
| parent | e93e47ae0434b53a20d1c62de62f34377bc8b492 (diff) | |
fix some warnings detected by pvs-studio
Diffstat (limited to 'examples/device/msc_dual_lun/src')
| -rw-r--r-- | examples/device/msc_dual_lun/src/msc_disk_dual.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/device/msc_dual_lun/src/msc_disk_dual.c b/examples/device/msc_dual_lun/src/msc_disk_dual.c index 775fa047e..694da11db 100644 --- a/examples/device/msc_dual_lun/src/msc_disk_dual.c +++ b/examples/device/msc_dual_lun/src/msc_disk_dual.c @@ -217,9 +217,9 @@ uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uin const char pid[] = "Mass Storage"; const char rev[] = "1.0"; - memcpy(inquiry_resp->vendor_id, vid, strlen(vid)); - memcpy(inquiry_resp->product_id, pid, strlen(pid)); - memcpy(inquiry_resp->product_rev, rev, strlen(rev)); + strncpy((char*) inquiry_resp->vendor_id, vid, 8); + strncpy((char*) inquiry_resp->product_id, pid, 16); + strncpy((char*) inquiry_resp->product_rev, rev, 4); return sizeof(scsi_inquiry_resp_t); // 36 bytes } @@ -227,9 +227,7 @@ uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uin // Invoked when received Test Unit Ready command. // return true allowing host to read/write this LUN e.g SD card inserted bool tud_msc_test_unit_ready_cb(uint8_t lun) { - if ( lun == 1 && board_button_read() ) return false; - - return true; // RAM disk is always ready + return ( lun == 1 && board_button_read() ) ? false : true; } // Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size |
