From: Aurelien DARRAGON Date: Thu, 28 Dec 2023 08:48:56 +0000 (+0100) Subject: MINOR: stktable: stktable_data_ptr() cannot fail in table_process_entry() X-Git-Tag: v3.0-dev1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41b7193e3cff7d3d84c161caf1cbcab7dbfce299;p=thirdparty%2Fhaproxy.git MINOR: stktable: stktable_data_ptr() cannot fail in table_process_entry() In table_process_entry(), stktable_data_ptr() result is dereferenced without checking if it's NULL first, which may happen when bad inputs are provided to the function. However, data_type and ts arguments were already checked prior to calling the function, so we know for sure that stktable_data_ptr() will never return NULL in this case. However some static code analyzers such as Coverity are being confused because they think that the result might possibly be NULL. (See GH #2398) To make it explicit that we always provide good inputs and expect valid result, let's switch to the __stktable_data_ptr() unsafe function. --- diff --git a/src/stick_table.c b/src/stick_table.c index 6b461c00ff..26c0db21a0 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -5025,7 +5025,7 @@ static int table_process_entry(struct appctx *appctx, struct stksess *ts, char * return 1; } - ptr = stktable_data_ptr(t, ts, data_type); + ptr = __stktable_data_ptr(t, ts, data_type); switch (stktable_data_types[data_type].std_type) { case STD_T_SINT: