lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 26 Jan 2022 03:16:58 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christoph Hellwig <hch@....de>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Jens Axboe <axboe@...nel.dk>,
        Johannes Thumshirn <johannes.thumshirn@....com>
Subject: block/blk-mq.c:1071:36: sparse: sparse: cast from restricted
 blk_status_t

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a08b41ab9e2e468647f78eb17c28e29b93006394
commit: 4054cff92c357813b6861b622122b344990f7e31 block: remove blk-exec.c
date:   8 weeks ago
config: csky-randconfig-s032-20220120 (https://download.01.org/0day-ci/archive/20220126/202201260028.1emkcjHZ-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4054cff92c357813b6861b622122b344990f7e31
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4054cff92c357813b6861b622122b344990f7e31
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


sparse warnings: (new ones prefixed by >>)
>> block/blk-mq.c:1071:36: sparse: sparse: cast from restricted blk_status_t
>> block/blk-mq.c:1164:17: sparse: sparse: cast to restricted blk_status_t

vim +1071 block/blk-mq.c

  1061	
  1062	/**
  1063	 * blk_end_sync_rq - executes a completion event on a request
  1064	 * @rq: request to complete
  1065	 * @error: end I/O status of the request
  1066	 */
  1067	static void blk_end_sync_rq(struct request *rq, blk_status_t error)
  1068	{
  1069		struct completion *waiting = rq->end_io_data;
  1070	
> 1071		rq->end_io_data = (void *)(uintptr_t)error;
  1072	
  1073		/*
  1074		 * complete last, if this is a stack request the process (and thus
  1075		 * the rq pointer) could be invalid right after this complete()
  1076		 */
  1077		complete(waiting);
  1078	}
  1079	
  1080	/**
  1081	 * blk_execute_rq_nowait - insert a request to I/O scheduler for execution
  1082	 * @bd_disk:	matching gendisk
  1083	 * @rq:		request to insert
  1084	 * @at_head:    insert request at head or tail of queue
  1085	 * @done:	I/O completion handler
  1086	 *
  1087	 * Description:
  1088	 *    Insert a fully prepared request at the back of the I/O scheduler queue
  1089	 *    for execution.  Don't wait for completion.
  1090	 *
  1091	 * Note:
  1092	 *    This function will invoke @done directly if the queue is dead.
  1093	 */
  1094	void blk_execute_rq_nowait(struct gendisk *bd_disk, struct request *rq,
  1095				   int at_head, rq_end_io_fn *done)
  1096	{
  1097		WARN_ON(irqs_disabled());
  1098		WARN_ON(!blk_rq_is_passthrough(rq));
  1099	
  1100		rq->rq_disk = bd_disk;
  1101		rq->end_io = done;
  1102	
  1103		blk_account_io_start(rq);
  1104	
  1105		/*
  1106		 * don't check dying flag for MQ because the request won't
  1107		 * be reused after dying flag is set
  1108		 */
  1109		blk_mq_sched_insert_request(rq, at_head, true, false);
  1110	}
  1111	EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
  1112	
  1113	static bool blk_rq_is_poll(struct request *rq)
  1114	{
  1115		if (!rq->mq_hctx)
  1116			return false;
  1117		if (rq->mq_hctx->type != HCTX_TYPE_POLL)
  1118			return false;
  1119		if (WARN_ON_ONCE(!rq->bio))
  1120			return false;
  1121		return true;
  1122	}
  1123	
  1124	static void blk_rq_poll_completion(struct request *rq, struct completion *wait)
  1125	{
  1126		do {
  1127			bio_poll(rq->bio, NULL, 0);
  1128			cond_resched();
  1129		} while (!completion_done(wait));
  1130	}
  1131	
  1132	/**
  1133	 * blk_execute_rq - insert a request into queue for execution
  1134	 * @bd_disk:	matching gendisk
  1135	 * @rq:		request to insert
  1136	 * @at_head:    insert request at head or tail of queue
  1137	 *
  1138	 * Description:
  1139	 *    Insert a fully prepared request at the back of the I/O scheduler queue
  1140	 *    for execution and wait for completion.
  1141	 * Return: The blk_status_t result provided to blk_mq_end_request().
  1142	 */
  1143	blk_status_t blk_execute_rq(struct gendisk *bd_disk, struct request *rq,
  1144			int at_head)
  1145	{
  1146		DECLARE_COMPLETION_ONSTACK(wait);
  1147		unsigned long hang_check;
  1148	
  1149		rq->end_io_data = &wait;
  1150		blk_execute_rq_nowait(bd_disk, rq, at_head, blk_end_sync_rq);
  1151	
  1152		/* Prevent hang_check timer from firing at us during very long I/O */
  1153		hang_check = sysctl_hung_task_timeout_secs;
  1154	
  1155		if (blk_rq_is_poll(rq))
  1156			blk_rq_poll_completion(rq, &wait);
  1157		else if (hang_check)
  1158			while (!wait_for_completion_io_timeout(&wait,
  1159					hang_check * (HZ/2)))
  1160				;
  1161		else
  1162			wait_for_completion_io(&wait);
  1163	
> 1164		return (blk_status_t)(uintptr_t)rq->end_io_data;
  1165	}
  1166	EXPORT_SYMBOL(blk_execute_rq);
  1167	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ