Re: [PATCH 01/12] dl_iterate_phdr.3: Cast 'ElfN_Word' to 'uintmax_t' for printf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>, 2020-09-12, 10:31:
* Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>, 2020-09-12, 01:14:
-        printf("    %2d: [%14p; memsz:%7lx] flags: %#x; ", j,
+        printf("    %2d: [%14p; memsz:%7jx] flags: %#jx; ", j,
                (void *) (info\->dlpi_addr +
info\->dlpi_phdr[j].p_vaddr),
-                info\->dlpi_phdr[j].p_memsz,
-                info\->dlpi_phdr[j].p_flags);
+                (uintmax_t) info\->dlpi_phdr[j].p_memsz,
+                (uintmax_t) info\->dlpi_phdr[j].p_flags);

The commit message is misleading. ElfN_Word is always uint32_t, regardless of N. On the other hand, on 64-bit architectures the type of p_memsz is Elf64_Xword (i.e., uint64_t), not Elf64_Word.

Thanks for noticing that.  I had doubts while reading the man page.
I think it could be a bit more clear, but maybe it's me that I don't speak elfic :p

Maybe 'ElfW(Word)' would be more appropriate?

I wouldn't know what "ElfW(Word)" means.

I'd write "Cast ELF types to uintmax_t" or something.

--
Jakub Wilk



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux