Re: [OS-BUILD PATCH] Fix gcc 12 warning address of 'mem_section' will never be NULL

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

 



From: Rafael Aquini on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1598#note_829750350

Well, any pointer to pointer can be NULL, either by being not-initialized or
explicitly assigned so,
so the compiler warning (-Waddress) might be considering some other contextual
knowledge, as in:

mm/sparse.c:
225 /* Record a memory area against a node. */
226 static void __init memory_present(int nid, unsigned long start, unsigned
long end)
227 {
228         unsigned long pfn;
229
230 #ifdef CONFIG_SPARSEMEM_EXTREME
231         if (unlikely(!mem_section)) {
232                 unsigned long size, align;
233
234                 size = sizeof(struct mem_section *) * NR_SECTION_ROOTS;
235                 align = 1 << (INTERNODE_CACHE_SHIFT);
236                 mem_section = memblock_alloc(size, align);
...

The warning seems off, in a first glance, specially because there's no throw
for  memory_present l:231...
Can't we just hint that preprocessor wrapped branch within __nr_to_section()
as unlikely, instead?
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux