You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/10/13 15:06:18 UTC

[incubator-nuttx] branch master updated: Minor fix in UBSan.

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new c22c07ba29 Minor fix in UBSan.
c22c07ba29 is described below

commit c22c07ba290fdb25c481b47566c17fdaa880c99e
Author: Fotis Panagiotopoulos <f....@amco.gr>
AuthorDate: Thu Oct 13 12:19:27 2022 +0300

    Minor fix in UBSan.
---
 mm/ubsan/ubsan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/ubsan/ubsan.c b/mm/ubsan/ubsan.c
index c7f0f2462f..ec90555dd7 100644
--- a/mm/ubsan/ubsan.c
+++ b/mm/ubsan/ubsan.c
@@ -157,11 +157,11 @@ static int64_t get_signed_val(FAR struct type_descriptor *type,
 {
   if (is_inline_int(type))
     {
-      unsigned extra_bits = sizeof(int64_t) * 8 - type_bit_width(type);
-      uint64_t mask = (1llu << extra_bits) - 1;
+      unsigned bits = type_bit_width(type);
+      uint64_t mask = (1llu << bits) - 1;
       uint64_t ret = (uint64_t)val & mask;
 
-      return (int64_t)(((ret & (1llu << (extra_bits - 1))) != 0) ?
+      return (int64_t)(((ret & (1llu << (bits - 1))) != 0) ?
              ret | ~mask : ret);
     }