Coverity flags UINT32_MAX - data.container_id as an underflow
when container_id could be UID_INVALID (UINT32_MAX). After
successful sd_json_dispatch_uid_gid(), the values are guaranteed
valid, but Coverity cannot trace through the callback. Add
asserts to document this invariant.
CID#
1548072
Follow-up for
91c4d1affdba02a323dc2c7caccabe240ccb8302
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
+#include "user-util.h"
/* TODO:
* OCI runtime tool implementation
if (r < 0)
return r;
+ /* Silence static analyzers, sd_json_dispatch_uid_gid() already validates */
+ assert(uid_is_valid(data.host_id));
+ assert(uid_is_valid(data.container_id));
+
if (data.range > UINT32_MAX - data.host_id ||
data.range > UINT32_MAX - data.container_id)
return json_log(v, flags, SYNTHETIC_ERRNO(EINVAL),