diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-02-04 12:02:19 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-02-04 12:08:25 -0800 |
commit | cff9fb78d5a4d52f05d7f525183b79209daa224c (patch) | |
tree | 74120ab4f5886759524730984a3d62792d5d29eb | |
parent | d819d64bfc04198cdb3f1989d285d16ad16726ee (diff) |
Fix -Wanalyzer-possible-null-argument warning in ATIDRIScreenInit
atidri.c:1033:7: warning: use of possibly-NULL ‘malloc(64)’ where non-null
expected [CWE-690] [-Wanalyzer-possible-null-argument]
1033 | sprintf( pDRIInfo->busIdString,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/atidri.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/atidri.c b/src/atidri.c index c1d3519..b6efe66 100644 --- a/src/atidri.c +++ b/src/atidri.c @@ -1029,12 +1029,11 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen ) if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) { pDRIInfo->busIdString = DRICreatePCIBusID(pATI->PCIInfo); } else { - pDRIInfo->busIdString = malloc( 64 ); - sprintf( pDRIInfo->busIdString, - "PCI:%d:%d:%d", - PCI_DEV_BUS(pATI->PCIInfo), - PCI_DEV_DEV(pATI->PCIInfo), - PCI_DEV_FUNC(pATI->PCIInfo) ); + XNFasprintf(&pDRIInfo->busIdString, + "PCI:%d:%d:%d", + PCI_DEV_BUS(pATI->PCIInfo), + PCI_DEV_DEV(pATI->PCIInfo), + PCI_DEV_FUNC(pATI->PCIInfo) ); } pDRIInfo->ddxDriverMajorVersion = MACH64_VERSION_MAJOR; pDRIInfo->ddxDriverMinorVersion = MACH64_VERSION_MINOR; |