Skip to content

Commit 4174ae9

Browse files
pabigotmbolivar-nordic
authored andcommitted
[nrf fromlist] drivers: flash: nrf_qspi_nor: reject zero length transfer
The check for small transfers inadvertently allowed a transfer of zero bytes, which should be an error (invalid parameter). Signed-off-by: Peter Bigot <[email protected]> Signed-off-by: Sigvart Hovland <[email protected]> (cherry picked from commit 7d847b4)
1 parent 0fd709a commit 4174ae9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/flash/nrf_qspi_nor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static int qspi_nor_read(struct device *dev, off_t addr, void *dest,
503503
/* Since the QSPI driver requires data to be at least 4 bytes we need
504504
* to use a 4 byte buffer for reads smaller than 4 bytes.
505505
*/
506-
if (size < 4U) {
506+
if ((size > 0) && (size < 4U)) {
507507
dest = buf;
508508
size = sizeof(buf);
509509
} else if ((size % 4U) != 0) {

0 commit comments

Comments
 (0)