You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/03 18:09:59 UTC

[incubator-nuttx] branch master updated: select: fix asan report error

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

xiaoxiang 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 3cabd49  select: fix asan report error
3cabd49 is described below

commit 3cabd49d49ed7722a26b80de03393f8d706cf6da
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Mar 15 20:21:39 2021 +0800

    select: fix asan report error
    
    vfs/fs_select.c:116:25: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    vfs/fs_select.c:153:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    
    Change-Id: I2e32bb8a3db8ff5a5955b83b382ac2fa5756122c
    Signed-off-by: ligd <li...@xiaomi.com>
---
 include/sys/select.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sys/select.h b/include/sys/select.h
index 988685b..956b7d1 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -71,11 +71,11 @@
 /* Standard helper macros */
 
 #define FD_CLR(fd,set) \
-  ((((fd_set*)(set))->arr)[_FD_NDX(fd)] &= ~(1 << _FD_BIT(fd)))
+  ((((fd_set*)(set))->arr)[_FD_NDX(fd)] &= ~(UINT32_C(1)<< _FD_BIT(fd)))
 #define FD_SET(fd,set) \
-  ((((fd_set*)(set))->arr)[_FD_NDX(fd)] |= (1 << _FD_BIT(fd)))
+  ((((fd_set*)(set))->arr)[_FD_NDX(fd)] |= (UINT32_C(1) << _FD_BIT(fd)))
 #define FD_ISSET(fd,set) \
-  (((((fd_set*)(set))->arr)[_FD_NDX(fd)] & (1 << _FD_BIT(fd))) != 0)
+ (((((fd_set*)(set))->arr)[_FD_NDX(fd)] & (UINT32_C(1) << _FD_BIT(fd))) != 0)
 #define FD_ZERO(set) \
    memset((set), 0, sizeof(fd_set))