Skip to content

Conversation

@benpicco
Copy link
Contributor

SPIFFS_write(&spi_fs, fd, buf, count) with buf = NULL can be valid when dumping the firmware of a microcontroller with internal flash mapped to address 0x0.

SPIFFS_write(&spi_fs, fd, 0x0, firmware_size) would previously omit the first page when dumping the firmware to flash (all 0xFF).

Visualization of the problem:

first page missing

Use len instead to signal where only page header is stored in spiffs_page_allocate_data.

@christianeisendle
Copy link

My 2 cents on this: If NULL points on a specific platform to a valid address, then the defintion for NULL should be changed instead removing NULL pointer checks from code.

@benpicco
Copy link
Contributor Author

benpicco commented Mar 1, 2017

Well it's not really a NULL pointer check in this case rather than the use of the NULL parameter for in-band signalling. It's just as valid to use the len parameter for in-band signaling here without breaking this use-case.

SPIFFS_write(&spi_fs, fd, buf, count) with buf = 0x0 can be valid when dumping the firmware of the microcontroller mapped to address 0x0.

SPIFFS_write(&spi_fs, fd, 0x0, firmware_size) would previously omit the first page when dumping the firmware to flash (all 0xFF).

Use len instead to signal where only page header is stored in spiffs_page_allocate_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants