Skip to content

bootconfig: Fix missing return check of xbc_node_compose_key function

Julio Faracco requested to merge jfaracco/centos-stream-9:bootconfig into main

Bugzilla: https://bugzilla.redhat.com/2217634

This MR is a fix for the stand-alone compilation of bootconfig tool. The error can be seen below:

gcc main.c /tmp/centos-stream-9/lib/bootconfig.c -Wall -g -I/tmp/centos-stream-9/tools/bootconfig/include -o bootconfig
main.c: In function ‘xbc_show_list’:
main.c:117:71: error: ‘ret’ undeclared (first use in this function)
  117 |                         fprintf(stderr, "Failed to compose key %d\n", ret);
      |                                                                       ^~~
main.c:117:71: note: each undeclared identifier is reported only once for each function it appears in
/tmp/centos-stream-9/lib/bootconfig.c: In function ‘xbc_destroy_all’:
/tmp/centos-stream-9/lib/bootconfig.c:795:9: warning: implicit declaration of function ‘memblock_free’; did you mean ‘memblock_free_ptr’? [-Wimplicit-function-declaration]
  795 |         memblock_free(xbc_nodes, sizeof(struct xbc_node) * XBC_NODE_MAX);
      |         ^~~~~~~~~~~~~
      |         memblock_free_ptr
make: *** [Makefile:21: bootconfig] Error 1

The patch would require the upstream commit 77e02cf57b6 to fix the second warning, but it impacts other subsystems. The low-hanging fruit solution is to change tools/bootconfig/include/linux/bootconfig.h to the same API of memblock. This section is also removed in newer kernel versions, which means that the change has a low impact on the subsequent releases.

Signed-off-by: Julio Faracco jfaracco@redhat.com

Edited by Julio Faracco

Merge request reports