On Fri, Jun 2, 2017 at 2:23 AM, Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx> wrote: > > > On 01/06/17 21:27, Luc Van Oostenryck wrote: >> sparse will warn if memcpy() (or memset(), copy_from_user(), >> copy_to_user()) is called with a very large static byte-count. >> >> But this warning is given unconditionaly while there are projects >> where this warning may not be not desired. >> >> Change this by making this warning conditional on a new warning >> flag: -Wmemcpy-max-count=COUNT. > > As always, the hardest part for me is naming. I can't remember exactly > what I called it, but I wanted something which would kinda sum up > all the functions. So, it was something like -Wmem-move-limit=n, or > something like that, and so the test was disabled by setting it to > zero. Yes, the name is far from ideal. I used 'memcpy' for the name because I think it's the most representative but I would like to have a better name. I considered for a while something like '-Wmem-operations' or '-Wmem-functions', now I'm just thinking about '-Wmem-transfert-limit=...', I dunno. > -Wmemcpy-max-count=count is probably a better name! ;-) >> diff --git a/sparse.1 b/sparse.1 >> index c924b3a59..efbd78d01 100644 >> --- a/sparse.1 >> +++ b/sparse.1 >> @@ -210,6 +210,14 @@ trouble. >> Sparse does not issue these warnings by default. >> . >> .TP >> +.B \-Wmemcpy\-max\-count >> +Warn about call of \fBmemset()\fR, \fBmemset()\fR, \fBcopy_from_user()\fR, or > ^^^^^^^ ^^^^^^^^ > memcpy() and memset() Ah yes, good catch. Thanks. -- Luc -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html