]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[ncm] Treat a zero divisor as indicating no alignment requirements
authorMichael Brown <mcb30@ipxe.org>
Thu, 1 Oct 2020 23:04:26 +0000 (00:04 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 1 Oct 2020 23:04:26 +0000 (00:04 +0100)
commiteede697ece879c5f9bba341a155f03235c42f2df
tree7c062987233342b34a916f00162129338ca218f7
parent02201417104c751545dda261eb33f0012703d1ff
[ncm] Treat a zero divisor as indicating no alignment requirements

A zero divisor will currently lead to a 16-bit integer overflow when
calculating the transmit padding, and a potential division by zero if
assertions are enabled.

Avoid these problems by treating a divisor value of zero as equivalent
to a divisor value of one (i.e. no alignment requirements).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/ncm.c