fprintf: Avoid null dereference with NULL configs
Adding support for suppress_packed and leaving out bitfield paddings at the end of classes when no alignment info is available accidentally used conf instead of cconf, where conf can be NULL, which causes cconf to have the default fprintf config. Fixes:986a3b58a8
("fprintf: Only add bitfield forced paddings when alignment info available") Fixes:9a4d719304
("fprintf: Allow suppressing the inferred __attribute__((__packed__))") Signed-off-by: Timo Paulssen <timonator@perpetuum-immobile.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
568dae4bd4
commit
3ed9a67967
|
@ -1619,8 +1619,8 @@ static size_t __class__fprintf(struct class *class, const struct cu *cu,
|
|||
* BTF doesn't have alignment info, for now use this infor from the loader
|
||||
* to avoid adding the forced bitfield paddings and have btfdiff happy.
|
||||
*/
|
||||
if (class->padding != 0 && type->alignment == 0 && conf->has_alignment_info &&
|
||||
!conf->suppress_force_paddings) {
|
||||
if (class->padding != 0 && type->alignment == 0 && cconf.has_alignment_info &&
|
||||
!cconf.suppress_force_paddings) {
|
||||
tag_pos = cu__type(cu, last->tag.type);
|
||||
size = tag__size(tag_pos, cu);
|
||||
|
||||
|
@ -1716,7 +1716,7 @@ static size_t __class__fprintf(struct class *class, const struct cu *cu,
|
|||
out:
|
||||
printed += fprintf(fp, "%.*s}", indent, tabs);
|
||||
|
||||
if (class->is_packed && !conf->suppress_packed)
|
||||
if (class->is_packed && !cconf.suppress_packed)
|
||||
printed += fprintf(fp, " __attribute__((__packed__))");
|
||||
|
||||
if (cconf.suffix)
|
||||
|
|
Loading…
Reference in New Issue