From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D604C433F5 for ; Thu, 9 Dec 2021 00:20:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34ECA6B0072; Wed, 8 Dec 2021 19:20:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FE376B0073; Wed, 8 Dec 2021 19:20:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EC506B0074; Wed, 8 Dec 2021 19:20:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 0E8E56B0072 for ; Wed, 8 Dec 2021 19:20:07 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B90BB82499B9 for ; Thu, 9 Dec 2021 00:19:56 +0000 (UTC) X-FDA: 78896347992.26.FF76C22 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf30.hostedemail.com (Postfix) with ESMTP id ADC4580005 for ; Thu, 9 Dec 2021 00:19:55 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10192"; a="235495574" X-IronPort-AV: E=Sophos;i="5.88,190,1635231600"; d="scan'208";a="235495574" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2021 16:19:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,190,1635231600"; d="scan'208";a="680123120" Received: from lkp-server02.sh.intel.com (HELO 9e1e9f9b3bcb) ([10.239.97.151]) by orsmga005.jf.intel.com with ESMTP; 08 Dec 2021 16:19:01 -0800 Received: from kbuild by 9e1e9f9b3bcb with local (Exim 4.92) (envelope-from ) id 1mv79I-0001Eo-Hb; Thu, 09 Dec 2021 00:19:00 +0000 Date: Thu, 9 Dec 2021 08:18:46 +0800 From: kernel test robot To: Daeho Jeong Cc: kbuild-all@lists.01.org, Linux Memory Management List , Jaegeuk Kim Subject: [linux-next:master 5567/5842] fs/f2fs/sysfs.c:491 __sbi_store() warn: unsigned 't' is never less than zero. Message-ID: <202112090853.JdT0VEOq-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: itqji8hwpgpud6is4esha9oduerinrse Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf30.hostedemail.com: domain of lkp@intel.com has no SPF policy when checking 192.55.52.93) smtp.mailfrom=lkp@intel.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: ADC4580005 X-HE-Tag: 1639009195-211087 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 4eee8d0b64ecc3231040fa68ba750317ffca5c52 commit: 38f953da2e3517444394000211c11cc82e67eb13 [5567/5842] f2fs: add gc_urgent_high_remaining sysfs node config: i386-randconfig-m021-20211207 (https://download.01.org/0day-ci/archive/20211209/202112090853.JdT0VEOq-lkp@intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot smatch warnings: fs/f2fs/sysfs.c:491 __sbi_store() warn: unsigned 't' is never less than zero. vim +/t +491 fs/f2fs/sysfs.c 332 333 static ssize_t __sbi_store(struct f2fs_attr *a, 334 struct f2fs_sb_info *sbi, 335 const char *buf, size_t count) 336 { 337 unsigned char *ptr; 338 unsigned long t; 339 unsigned int *ui; 340 ssize_t ret; 341 342 ptr = __struct_ptr(sbi, a->struct_type); 343 if (!ptr) 344 return -EINVAL; 345 346 if (!strcmp(a->attr.name, "extension_list")) { 347 const char *name = strim((char *)buf); 348 bool set = true, hot; 349 350 if (!strncmp(name, "[h]", 3)) 351 hot = true; 352 else if (!strncmp(name, "[c]", 3)) 353 hot = false; 354 else 355 return -EINVAL; 356 357 name += 3; 358 359 if (*name == '!') { 360 name++; 361 set = false; 362 } 363 364 if (!strlen(name) || strlen(name) >= F2FS_EXTENSION_LEN) 365 return -EINVAL; 366 367 down_write(&sbi->sb_lock); 368 369 ret = f2fs_update_extension_list(sbi, name, hot, set); 370 if (ret) 371 goto out; 372 373 ret = f2fs_commit_super(sbi, false); 374 if (ret) 375 f2fs_update_extension_list(sbi, name, hot, !set); 376 out: 377 up_write(&sbi->sb_lock); 378 return ret ? ret : count; 379 } 380 381 if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) { 382 const char *name = strim((char *)buf); 383 struct ckpt_req_control *cprc = &sbi->cprc_info; 384 int class; 385 long data; 386 int ret; 387 388 if (!strncmp(name, "rt,", 3)) 389 class = IOPRIO_CLASS_RT; 390 else if (!strncmp(name, "be,", 3)) 391 class = IOPRIO_CLASS_BE; 392 else 393 return -EINVAL; 394 395 name += 3; 396 ret = kstrtol(name, 10, &data); 397 if (ret) 398 return ret; 399 if (data >= IOPRIO_NR_LEVELS || data < 0) 400 return -EINVAL; 401 402 cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, data); 403 if (test_opt(sbi, MERGE_CHECKPOINT)) { 404 ret = set_task_ioprio(cprc->f2fs_issue_ckpt, 405 cprc->ckpt_thread_ioprio); 406 if (ret) 407 return ret; 408 } 409 410 return count; 411 } 412 413 ui = (unsigned int *)(ptr + a->offset); 414 415 ret = kstrtoul(skip_spaces(buf), 0, &t); 416 if (ret < 0) 417 return ret; 418 #ifdef CONFIG_F2FS_FAULT_INJECTION 419 if (a->struct_type == FAULT_INFO_TYPE && t >= (1 << FAULT_MAX)) 420 return -EINVAL; 421 if (a->struct_type == FAULT_INFO_RATE && t >= UINT_MAX) 422 return -EINVAL; 423 #endif 424 if (a->struct_type == RESERVED_BLOCKS) { 425 spin_lock(&sbi->stat_lock); 426 if (t > (unsigned long)(sbi->user_block_count - 427 F2FS_OPTION(sbi).root_reserved_blocks)) { 428 spin_unlock(&sbi->stat_lock); 429 return -EINVAL; 430 } 431 *ui = t; 432 sbi->current_reserved_blocks = min(sbi->reserved_blocks, 433 sbi->user_block_count - valid_user_blocks(sbi)); 434 spin_unlock(&sbi->stat_lock); 435 return count; 436 } 437 438 if (!strcmp(a->attr.name, "discard_granularity")) { 439 if (t == 0 || t > MAX_PLIST_NUM) 440 return -EINVAL; 441 if (!f2fs_block_unit_discard(sbi)) 442 return -EINVAL; 443 if (t == *ui) 444 return count; 445 *ui = t; 446 return count; 447 } 448 449 if (!strcmp(a->attr.name, "migration_granularity")) { 450 if (t == 0 || t > sbi->segs_per_sec) 451 return -EINVAL; 452 } 453 454 if (!strcmp(a->attr.name, "trim_sections")) 455 return -EINVAL; 456 457 if (!strcmp(a->attr.name, "gc_urgent")) { 458 if (t == 0) { 459 sbi->gc_mode = GC_NORMAL; 460 } else if (t == 1) { 461 sbi->gc_mode = GC_URGENT_HIGH; 462 if (sbi->gc_thread) { 463 sbi->gc_thread->gc_wake = 1; 464 wake_up_interruptible_all( 465 &sbi->gc_thread->gc_wait_queue_head); 466 wake_up_discard_thread(sbi, true); 467 } 468 } else if (t == 2) { 469 sbi->gc_mode = GC_URGENT_LOW; 470 } else { 471 return -EINVAL; 472 } 473 return count; 474 } 475 if (!strcmp(a->attr.name, "gc_idle")) { 476 if (t == GC_IDLE_CB) { 477 sbi->gc_mode = GC_IDLE_CB; 478 } else if (t == GC_IDLE_GREEDY) { 479 sbi->gc_mode = GC_IDLE_GREEDY; 480 } else if (t == GC_IDLE_AT) { 481 if (!sbi->am.atgc_enabled) 482 return -EINVAL; 483 sbi->gc_mode = GC_AT; 484 } else { 485 sbi->gc_mode = GC_NORMAL; 486 } 487 return count; 488 } 489 490 if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) { > 491 if (t < 0) 492 return -EINVAL; 493 494 spin_lock(&sbi->gc_urgent_high_lock); 495 sbi->gc_urgent_high_limited = t == 0 ? false : true; 496 sbi->gc_urgent_high_remaining = t; 497 spin_unlock(&sbi->gc_urgent_high_lock); 498 499 return count; 500 } 501 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org