[bug report] shmem: prepare huge= mount option and sysfs knob

From: Dan Carpenter <hidden>
Date: 2017-08-17 10:25:37

Hello Kirill A. Shutemov,

The patch 5a6e75f8110c: "shmem: prepare huge= mount option and sysfs
knob" from Jul 26, 2016, leads to the following static checker
warning:

	mm/shmem.c:4013 shmem_init()
	warn: assigning (-2) to unsigned variable 'SHMEM_SB(shm_mnt->mnt_sb)->huge'

mm/shmem.c
  4012  #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
  4013          if (has_transparent_hugepage() && shmem_huge < SHMEM_HUGE_DENY)
  4014                  SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge;


SHMEM_HUGE_DENY is -1 so the value less than that is SHMEM_HUGE_FORCE (-2).

  4015          else
  4016                  shmem_huge = 0; /* just in case it was patched */
  4017  #endif
  4018          return 0;

Btw, if shmem_parse_huge() returns SHMEM_HUGE_FORCE, then both callers
treat that as an error.  The handling for SHMEM_HUGE_FORCE is confusing
for my tiny brain.

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help