[07/20] Use uintptr_t in fts for pointer alignment

Message ID 5703dc6417979ab222d19f31e9d363c7bc415e96.1666877952.git.szabolcs.nagy@arm.com
State Committed
Commit f4973d31bb0673bc6a5fc207713837f143920b01
Headers
Series patches from the morello port |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Szabolcs Nagy Oct. 27, 2022, 3:32 p.m. UTC
  The code assumed unsigned long can represent pointers.
---
 io/fts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Adhemerval Zanella Netto Oct. 31, 2022, 4:08 p.m. UTC | #1
On 27/10/22 12:32, Szabolcs Nagy via Libc-alpha wrote:
> The code assumed unsigned long can represent pointers.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  io/fts.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/io/fts.c b/io/fts.c
> index 283cf1791a..5a0a47a360 100644
> --- a/io/fts.c
> +++ b/io/fts.c
> @@ -55,6 +55,7 @@ static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
>  #include <dirent.h>
>  #include <errno.h>
>  #include <fts.h>
> +#include <stdint.h>
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> @@ -67,7 +68,7 @@ static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
>  #endif
>  /* Align P to that size.  */
>  #ifndef ALIGN
> -#define	ALIGN(p)	(((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
> +#define	ALIGN(p)	(((uintptr_t) (p) + ALIGNBYTES) & ~ALIGNBYTES)
>  #endif
>  
>
  

Patch

diff --git a/io/fts.c b/io/fts.c
index 283cf1791a..5a0a47a360 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -55,6 +55,7 @@  static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
 #include <dirent.h>
 #include <errno.h>
 #include <fts.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -67,7 +68,7 @@  static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
 #endif
 /* Align P to that size.  */
 #ifndef ALIGN
-#define	ALIGN(p)	(((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
+#define	ALIGN(p)	(((uintptr_t) (p) + ALIGNBYTES) & ~ALIGNBYTES)
 #endif