]> git.ipfire.org Git - thirdparty/collectd.git/commit
gpu_sysman: initialize struct .pNext members before use
authorEero Tamminen <eero.t.tamminen@intel.com>
Thu, 17 Nov 2022 20:19:07 +0000 (22:19 +0200)
committerMatthias Runge <mrunge@matthias-runge.de>
Wed, 1 Feb 2023 06:55:27 +0000 (07:55 +0100)
commitb18aed6930d9ce91534c41ce90453588ec006950
treebea921bf0638e663a37a7e770ced7aa58d60929d
parent55a9296a0ec1b4d8d1605387f20a1304b25baa32
gpu_sysman: initialize struct .pNext members before use

Next Sysman spec will explictly state that they need be initialized:
https://github.com/oneapi-src/level-zero-spec/commit/98dfaaf041dedfd8c9bcf9a3957f334836e859e4

And latest Sysman backend versions corrupt memory / crash unless .pNext
values in some of the structs given to Get functions are initialized.

(Releases before fall 2022 did not use .pNext values in get* calls,
and worked fine. It just took a long time until I was able to verify
whether this was a regression that will be fixed, or intended change.)

Additionally, validate in test code that .pNext values are set to NULL
(because some structs lack those pointer members, ADD_METRIC() macro
cannot do that check for the <statename> functions given for it, but
otherwise everything is covered).

Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/gpu_sysman.c
src/gpu_sysman_test.c