aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/eval/array-quals0.c
AgeCommit message (Collapse)AuthorFilesLines
2020-07-13fix evaluation error with assignment of qualified arraysLuc Van Oostenryck1-1/+0
This is a fix for a problem reported today to the mailing list. In check_assignment_types(), the first 'level' is checked by the function itself but the next level is checked by the type_difference(). This later function take as arguments, beside the types to be checked, the modifiers that can be assumed for each of the types (this works as a kind of reverse mask). But these modifiers are taken from target_qualifiers() which, purposely ignore the modifiers for arrays introduced in commit 984b7b66457c ("[PATCH] deal correctly with qualifiers on arrays") with the comment: "Pointers to any array are considered as pointers to unqualified type as far as implicit conversions are concerned" But by dropping these modifiers, type_difference() reports incorrect results for pointers to qualified arrays. So, do not use target_qualifiers() but take the modifiers directly from the ctypes. Admittingly, I'm far from sure that this is the right fix but it solve several wrong cases. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2020-07-09add a testcase for assignment to const <type> (*)[]Luc Van Oostenryck1-0/+7
You can assign a '<type>[]' to a 'const <type> *'. Likewise, you can assign a '<type>[][N]' to a 'const <type> (*)[N]' but sparse doesn't like this. Analyzed-by: Ard Biesheuvel <ardb@kernel.org> Reported-by: Herbert Xu <herbert@gondor.apana.org.au> Link: https://lore.kernel.org/linux-crypto/20200709120937.GA13332@gondor.apana.org.au/ Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>