Skip to content

Assure msc device block size is not zero#1113

Merged
hathach merged 3 commits into
hathach:masterfrom
szymonh:master
Sep 30, 2021
Merged

Assure msc device block size is not zero#1113
hathach merged 3 commits into
hathach:masterfrom
szymonh:master

Conversation

@szymonh
Copy link
Copy Markdown
Contributor

@szymonh szymonh commented Sep 27, 2021

In case total_bytes divided by block_count evaluates to zero a division by zero may happen in proc_read10_cmd leading to a crash.

@hathach hathach changed the base branch from master to enhance September 30, 2021 13:15
@hathach hathach changed the base branch from enhance to master September 30, 2021 13:15
Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the PR. I take a look back at the MSC BOT specs, the case where total bytes < block num is actually counted as

  • READ10: case 7 Hi < Di host read less than device want to send or
  • WRITE10 (we need this check for write as well): case 13 Ho < Do, host send less than device would like to receive

In both cases, the specs say we must response with phase error. Therefore, I made a bit of changes and push the update

image

@hathach hathach merged commit e7ef322 into hathach:master Sep 30, 2021
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