[Bug 2073] New: Unnecessary check for alignment and unreachable code in cpukit/score/src/coremsg.c

Krzysztof Mięsowicz krzysztof.miesowicz at gmail.com
Wed Aug 15 14:54:18 UTC 2012


I check this once again and re-analyze this code. I think I has done
mistake. After reading this comment once again it seems that second
if-statement which I supposed to be unnecessary is necessary... It checks
for overflow. When I was analyzing this code before I didn't see it.

Code above second if-statement can't make allocated_message_size variable
less than maximum_message_size normally. But maximum_message_size would be
very close to SIZE_MAX, adding an overhead to allocated_message_size can
cause an overflow. And then allocated_message_size will be less than
maximum_message_size.

I'm sorry for this error and mess. I should be more careful and remember
about possibility of overflow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120815/4743d714/attachment-0001.html>


More information about the devel mailing list