On Thu, Jul 09, 2020 at 10:09:37PM +1000, Herbert Xu wrote: > On Thu, Jul 09, 2020 at 11:51:10AM +0300, Ard Biesheuvel wrote: > > > > That looks like a sparse bug to me. Since when is it not allowed to > > pass a non-const value as a const parameter? > > > > I.e., you can pass a u64[] to a function that takes a u64 const *, > > giving the caller the guarantee that their u64[] will not be modified > > during the call, even if it is passed by reference. > > > > Here, we are dealing with u64[][2], but the same reasoning holds. A > > const u64[][2] formal parameter (or u64 const (*)[2] which comes down > > to the same thing) does not require a const argument, it only tells > > the caller that the array will be left untouched. This is why the > > compiler is perfectly happy with this arrangement. > > You're right. Luc, here is the patch that triggers the bogus > warning with sparse. Thanks for the analysis and the bug report. A fix is under way and should be upstreamed in a few days. -- Luc