flow: bail out earlier on parsing giant arrays
commit87ccaba1653caf265ee647e68fd7b03f40db1f9b
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 8 Apr 2024 15:37:20 +0000 (8 18:37 +0300)
committerDan Carpenter <dan.carpenter@linaro.org>
Mon, 8 Apr 2024 15:37:20 +0000 (8 18:37 +0300)
treef3d7e91946e05b7f8e3c18f4852e4c6264acd67e
parent7edae857e5ccb79ce37d2c9468df84849f29be85
flow: bail out earlier on parsing giant arrays

The drivers/net/wireless/realtek/rtw89/rtw8851b_table.c file has a bunch
of arrays which are giant.  The first one is 976 elements.  When you were
doing an --info run then it took Smatch over an hour to parse that file.

And actually the information we're saving is kind of garbage.  Instead of
saying 0-s32max it ends up being some list of numbers with a ... on the
end. "0,4,7,1999, 2000, ...".

This function does a weird thing where it treats globals differently from
local variables.  I feel like I probably did that because globals are
often huge and parsing them is slow...  But really I think that ideally
we would use __split_expr().

Anyway, what I've done here is that I've said if the array is more than 256
elements then do:

my_array[unknown()] = unknown();

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
smatch_flow.c