Hi Thiago,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.16-rc5 next-20211214]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Thiago-Rafael-Becker/cifs-saniti...
base:
git://git.samba.org/sfrench/cifs-2.6.git for-next
config: x86_64-randconfig-s022-20211214
(
https://download.01.org/0day-ci/archive/20211215/202112151551.AfQ7J0wz-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
#
https://github.com/0day-ci/linux/commit/e81ed85a4288e898bc0607106d98905be...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Thiago-Rafael-Becker/cifs-sanitize-multiple-delimiters-in-prepath/20211215-110931
git checkout e81ed85a4288e898bc0607106d98905be5cd3788
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir
ARCH=x86_64 SHELL=/bin/bash fs/cifs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> fs/cifs/fs_context.c:442:6: warning: no previous prototype for
'sanitize_path' [-Wmissing-prototypes]
442 | void sanitize_path(char
*path) {
| ^~~~~~~~~~~~~
sparse warnings: (new ones prefixed by >>)
> fs/cifs/fs_context.c:442:6: sparse: sparse: symbol
'sanitize_path' was not declared. Should it be static?
Please review and possibly fold the followup patch.
vim +/sanitize_path +442 fs/cifs/fs_context.c
436
437 /*
438 * remove duplicate path delimiters. Windows is supposed to do that
439 * but there are some bugs that prevent rename from working if there are
440 * multiple delimiters.
441 */
442 void sanitize_path(char *path) {
443 char *pos =
path, last = *path;
444 unsigned int offset = 0;
445
446 while(*(++pos)) {
447 if ((*pos == '/' || *pos == '\\') && (last
== '/' || last == '\\')) {
448 offset++;
449 continue;
450 }
451
452 last = *pos;
453 *(pos - offset) = *pos;
454 }
455
456 pos = pos - offset - 1;
457
458 /* At this point, there should be only zero or one delimiter at the end of
the string */
459 if (*pos != '/' && *pos != '\\')
460 pos++;
461
462 *pos = '\0';
463 }
464
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org