From 28c1630f54d4e04162a7b497546775c195adcdce Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Sat, 20 May 2023 22:16:09 +0200 Subject: [PATCH] sys/usb/usbus_msc: fix typo in C expression Rather than setting the correct blk_len, the code only wrote 1 and 0 into the three bytes due to the use of a logic and where a bitwise and should be used. --- sys/usb/usbus/msc/scsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/usb/usbus/msc/scsi.c b/sys/usb/usbus/msc/scsi.c index 50ab2db2f3..b72ef34daf 100644 --- a/sys/usb/usbus/msc/scsi.c +++ b/sys/usb/usbus/msc/scsi.c @@ -163,9 +163,9 @@ static void _scsi_read_format_capacities(usbus_handler_t *handler, uint8_t lun) pkt->type = SCSI_READ_FMT_CAPA_TYPE_FORMATTED; /* Manage endianness, bytes 11..9 -> LSB..MSB */ - pkt->blk_len[0] = (block_size >> 16) && 0xFF; - pkt->blk_len[1] = (block_size >> 8) && 0xFF; - pkt->blk_len[2] = block_size && 0xFF; + pkt->blk_len[0] = (block_size >> 16) & 0xFF; + pkt->blk_len[1] = (block_size >> 8) & 0xFF; + pkt->blk_len[2] = block_size & 0xFF; /* copy into ep buffer */ usbdev_ep_xmit(msc->ep_in->ep, (uint8_t *)pkt, sizeof(msc_read_fmt_capa_pkt_t));