Ayush Mittal <ayus...@samsung.com> wrote: > This patch check for shift exponent greater than 31,
Firstly, isn't it 63 on 64-bit machines? Secondly, this is the wrong way to do things. The banner comment on mpihelp_lshift(), for example, says that the function has the following argument constraints: 0 < CNT < BITS_PER_MP_LIMB so sh1 and sh2 must both be in the range 1-31 or 1-63, assuming cnt is within its constraints. Therefore if it needs a checking, you only need to check cnt on entry to the function, rather than checking sh1 and sh2 inside the loop. Further, you should use pr_err() so that we know that this has gone wrong and return an error to the caller (there are security implications). Further, have you checked the caller to see if they do ever violate the constraints? It looks like you're adding fixes for your test, not for the code. David