Skip to content

Commit 332a2fc

Browse files
jaz1-nordicmasz-nordic
authored andcommitted
drivers: sdp: mspi: incorrect parameters protection
Protection against incorrect device config parameters. Signed-off-by: Jakub Zymelka <[email protected]>
1 parent 4731c9b commit 332a2fc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

applications/sdp/mspi/src/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,13 @@ static void config_pins(nrfe_mspi_pinctrl_soc_pin_msg_t *pins_cfg)
314314
uint32_t psel = NRF_GET_PIN(pins_cfg->pin[i]);
315315
uint32_t fun = NRF_GET_FUN(pins_cfg->pin[i]);
316316

317+
if ((psel == NRF_PIN_DISCONNECTED) || (pins_cfg->pin[i] == 0)) {
318+
continue;
319+
}
320+
317321
uint8_t pin_number = NRF_PIN_NUMBER_TO_PIN(psel);
318322

319-
NRFX_ASSERT(pin_number < VIO_COUNT)
323+
NRFX_ASSERT(pin_number < VIO_COUNT);
320324

321325
if ((fun >= NRF_FUN_SDP_MSPI_CS0) && (fun <= NRF_FUN_SDP_MSPI_CS4)) {
322326

drivers/mspi/mspi_nrfe.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ static int api_dev_config(const struct device *dev, const struct mspi_dev_id *de
420420
int rc;
421421
nrfe_mspi_dev_config_msg_t mspi_dev_config_msg;
422422

423+
if (param_mask == MSPI_DEVICE_CONFIG_NONE) {
424+
return 0;
425+
}
426+
423427
if (param_mask & MSPI_DEVICE_CONFIG_MEM_BOUND) {
424428
if (cfg->mem_boundary) {
425429
LOG_ERR("Memory boundary is not supported.");

0 commit comments

Comments
 (0)