<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Fair enough. I'll update the patch. Thanks!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 17, 2024 at 12:45 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 16.01.24 21:02, Kinsey Moore wrote:<br>
> The two operands are 16 bit and the result is being saved into a<br>
> larger type. Reduce the possibility of an overflow during multiplication<br>
> by using the larger type as an operand.<br>
> ---<br>
> cpukit/score/src/objectextendinformation.c | 3 ++-<br>
> 1 file changed, 2 insertions(+), 1 deletion(-)<br>
> <br>
> diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c<br>
> index 414766f219..f9c51c3bec 100644<br>
> --- a/cpukit/score/src/objectextendinformation.c<br>
> +++ b/cpukit/score/src/objectextendinformation.c<br>
> @@ -115,7 +115,8 @@ Objects_Maximum _Objects_Extend_information(<br>
> * Allocate the name table, and the objects and if it fails either return or<br>
> * generate a fatal error depending on auto-extending being active.<br>
> */<br>
> - object_block_size = extend_count * information->object_size;<br>
> + object_block_size = extend_count;<br>
> + object_block_size *= information->object_size;<br>
> new_object_block = _Workspace_Allocate( object_block_size );<br>
> if ( new_object_block == NULL ) {<br>
> return 0;<br>
<br>
I am not sure if a reviewer understands that this two line approach is <br>
there to avoid integer overflows. I would simply keep the expression as <br>
is and change extend_count to:<br>
<br>
uint32_t extend_count;<br>
<br>
-- <br>
embedded brains GmbH & Co. KG<br>
Herr Sebastian HUBER<br>
Dornierstr. 4<br>
82178 Puchheim<br>
Germany<br>
email: <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
phone: +49-89-18 94 741 - 16<br>
fax: +49-89-18 94 741 - 08<br>
<br>
Registergericht: Amtsgericht München<br>
Registernummer: HRB 157899<br>
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler<br>
Unsere Datenschutzerklärung finden Sie hier:<br>
<a href="https://embedded-brains.de/datenschutzerklaerung/" rel="noreferrer" target="_blank">https://embedded-brains.de/datenschutzerklaerung/</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div>