drivers/scsi/qedf/qedf_main.c:2218:18: sparse: sparse: incorrect type in assignment (different base types)
From: kernel test robot
Date: Sat May 23 2026 - 12:18:31 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 79bd2dded182b1d458b18e62684b7f82ffc682e5
commit: 2aa5801ada29948ce510fc8b1e3b3ec8162423e2 RISC-V: uaccess: Wrap the get_user_8 uaccess macro
date: 12 months ago
config: riscv-randconfig-r133-20260523 (https://download.01.org/0day-ci/archive/20260524/202605240047.9AdZeK4d-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260524/202605240047.9AdZeK4d-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 2aa5801ada29 ("RISC-V: uaccess: Wrap the get_user_8 uaccess macro")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605240047.9AdZeK4d-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
WARNING: invalid argument to '-march': '_zacas_zabha'
>> drivers/scsi/qedf/qedf_main.c:2218:18: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] prod_idx @@ got restricted __le16 @@
drivers/scsi/qedf/qedf_main.c:2218:18: sparse: expected unsigned short [usertype] prod_idx
drivers/scsi/qedf/qedf_main.c:2218:18: sparse: got restricted __le16
drivers/scsi/qedf/qedf_main.c:2247:18: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] prod_idx @@ got restricted __le16 @@
drivers/scsi/qedf/qedf_main.c:2247:18: sparse: expected unsigned short [usertype] prod_idx
drivers/scsi/qedf/qedf_main.c:2247:18: sparse: got restricted __le16
>> drivers/scsi/qedf/qedf_main.c:2264:33: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/qedf/qedf_main.c:2282:26: sparse: sparse: restricted __le32 degrades to integer
>> drivers/scsi/qedf/qedf_main.c:2513:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] fr_crc @@ got restricted __le32 [addressable] [usertype] fcoe_crc32 @@
drivers/scsi/qedf/qedf_main.c:2513:20: sparse: expected unsigned int [usertype] fr_crc
drivers/scsi/qedf/qedf_main.c:2513:20: sparse: got restricted __le32 [addressable] [usertype] fcoe_crc32
drivers/scsi/qedf/qedf_main.c:2709:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/qedf/qedf_main.c:2824:25: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/qedf/qedf_main.c:2827:18: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/qedf/qedf_main.c: note: in included file (through include/scsi/libfcoe.h, drivers/scsi/qedf/qedf.h):
include/scsi/fc/fc_fcoe.h:89:36: sparse: sparse: cast truncates bits from constant value (efc becomes fc)
include/scsi/fc/fc_fcoe.h:90:23: sparse: sparse: cast truncates bits from constant value (efc00 becomes 0)
drivers/scsi/qedf/qedf_main.c:1868:15: sparse: sparse: memcpy with byte count of 119872
vim +2218 drivers/scsi/qedf/qedf_main.c
61d8658b4a435e Dupuis, Chad 2017-02-15 2202
61d8658b4a435e Dupuis, Chad 2017-02-15 2203 static bool qedf_fp_has_work(struct qedf_fastpath *fp)
61d8658b4a435e Dupuis, Chad 2017-02-15 2204 {
61d8658b4a435e Dupuis, Chad 2017-02-15 2205 struct qedf_ctx *qedf = fp->qedf;
61d8658b4a435e Dupuis, Chad 2017-02-15 2206 struct global_queue *que;
61d8658b4a435e Dupuis, Chad 2017-02-15 2207 struct qed_sb_info *sb_info = fp->sb_info;
fb09a1ed5c6e50 Shai Malin 2021-10-04 2208 struct status_block *sb = sb_info->sb_virt;
61d8658b4a435e Dupuis, Chad 2017-02-15 2209 u16 prod_idx;
61d8658b4a435e Dupuis, Chad 2017-02-15 2210
61d8658b4a435e Dupuis, Chad 2017-02-15 2211 /* Get the pointer to the global CQ this completion is on */
61d8658b4a435e Dupuis, Chad 2017-02-15 2212 que = qedf->global_queues[fp->sb_id];
61d8658b4a435e Dupuis, Chad 2017-02-15 2213
61d8658b4a435e Dupuis, Chad 2017-02-15 2214 /* Be sure all responses have been written to PI */
61d8658b4a435e Dupuis, Chad 2017-02-15 2215 rmb();
61d8658b4a435e Dupuis, Chad 2017-02-15 2216
61d8658b4a435e Dupuis, Chad 2017-02-15 2217 /* Get the current firmware producer index */
61d8658b4a435e Dupuis, Chad 2017-02-15 @2218 prod_idx = sb->pi_array[QEDF_FCOE_PARAMS_GL_RQ_PI];
61d8658b4a435e Dupuis, Chad 2017-02-15 2219
61d8658b4a435e Dupuis, Chad 2017-02-15 2220 return (que->cq_prod_idx != prod_idx);
61d8658b4a435e Dupuis, Chad 2017-02-15 2221 }
61d8658b4a435e Dupuis, Chad 2017-02-15 2222
61d8658b4a435e Dupuis, Chad 2017-02-15 2223 /*
61d8658b4a435e Dupuis, Chad 2017-02-15 2224 * Interrupt handler code.
61d8658b4a435e Dupuis, Chad 2017-02-15 2225 */
61d8658b4a435e Dupuis, Chad 2017-02-15 2226
61d8658b4a435e Dupuis, Chad 2017-02-15 2227 /* Process completion queue and copy CQE contents for deferred processesing
61d8658b4a435e Dupuis, Chad 2017-02-15 2228 *
61d8658b4a435e Dupuis, Chad 2017-02-15 2229 * Return true if we should wake the I/O thread, false if not.
61d8658b4a435e Dupuis, Chad 2017-02-15 2230 */
61d8658b4a435e Dupuis, Chad 2017-02-15 2231 static bool qedf_process_completions(struct qedf_fastpath *fp)
61d8658b4a435e Dupuis, Chad 2017-02-15 2232 {
61d8658b4a435e Dupuis, Chad 2017-02-15 2233 struct qedf_ctx *qedf = fp->qedf;
61d8658b4a435e Dupuis, Chad 2017-02-15 2234 struct qed_sb_info *sb_info = fp->sb_info;
fb09a1ed5c6e50 Shai Malin 2021-10-04 2235 struct status_block *sb = sb_info->sb_virt;
61d8658b4a435e Dupuis, Chad 2017-02-15 2236 struct global_queue *que;
61d8658b4a435e Dupuis, Chad 2017-02-15 2237 u16 prod_idx;
61d8658b4a435e Dupuis, Chad 2017-02-15 2238 struct fcoe_cqe *cqe;
61d8658b4a435e Dupuis, Chad 2017-02-15 2239 struct qedf_io_work *io_work;
61d8658b4a435e Dupuis, Chad 2017-02-15 2240 unsigned int cpu;
61d8658b4a435e Dupuis, Chad 2017-02-15 2241 struct qedf_ioreq *io_req = NULL;
61d8658b4a435e Dupuis, Chad 2017-02-15 2242 u16 xid;
61d8658b4a435e Dupuis, Chad 2017-02-15 2243 u16 new_cqes;
61d8658b4a435e Dupuis, Chad 2017-02-15 2244 u32 comp_type;
61d8658b4a435e Dupuis, Chad 2017-02-15 2245
61d8658b4a435e Dupuis, Chad 2017-02-15 2246 /* Get the current firmware producer index */
61d8658b4a435e Dupuis, Chad 2017-02-15 2247 prod_idx = sb->pi_array[QEDF_FCOE_PARAMS_GL_RQ_PI];
61d8658b4a435e Dupuis, Chad 2017-02-15 2248
61d8658b4a435e Dupuis, Chad 2017-02-15 2249 /* Get the pointer to the global CQ this completion is on */
61d8658b4a435e Dupuis, Chad 2017-02-15 2250 que = qedf->global_queues[fp->sb_id];
61d8658b4a435e Dupuis, Chad 2017-02-15 2251
61d8658b4a435e Dupuis, Chad 2017-02-15 2252 /* Calculate the amount of new elements since last processing */
61d8658b4a435e Dupuis, Chad 2017-02-15 2253 new_cqes = (prod_idx >= que->cq_prod_idx) ?
61d8658b4a435e Dupuis, Chad 2017-02-15 2254 (prod_idx - que->cq_prod_idx) :
61d8658b4a435e Dupuis, Chad 2017-02-15 2255 0x10000 - que->cq_prod_idx + prod_idx;
61d8658b4a435e Dupuis, Chad 2017-02-15 2256
61d8658b4a435e Dupuis, Chad 2017-02-15 2257 /* Save producer index */
61d8658b4a435e Dupuis, Chad 2017-02-15 2258 que->cq_prod_idx = prod_idx;
61d8658b4a435e Dupuis, Chad 2017-02-15 2259
61d8658b4a435e Dupuis, Chad 2017-02-15 2260 while (new_cqes) {
61d8658b4a435e Dupuis, Chad 2017-02-15 2261 fp->completions++;
61d8658b4a435e Dupuis, Chad 2017-02-15 2262 cqe = &que->cq[que->cq_cons_idx];
61d8658b4a435e Dupuis, Chad 2017-02-15 2263
61d8658b4a435e Dupuis, Chad 2017-02-15 @2264 comp_type = (cqe->cqe_data >> FCOE_CQE_CQE_TYPE_SHIFT) &
61d8658b4a435e Dupuis, Chad 2017-02-15 2265 FCOE_CQE_CQE_TYPE_MASK;
61d8658b4a435e Dupuis, Chad 2017-02-15 2266
61d8658b4a435e Dupuis, Chad 2017-02-15 2267 /*
61d8658b4a435e Dupuis, Chad 2017-02-15 2268 * Process unsolicited CQEs directly in the interrupt handler
61d8658b4a435e Dupuis, Chad 2017-02-15 2269 * sine we need the fastpath ID
61d8658b4a435e Dupuis, Chad 2017-02-15 2270 */
61d8658b4a435e Dupuis, Chad 2017-02-15 2271 if (comp_type == FCOE_UNSOLIC_CQE_TYPE) {
61d8658b4a435e Dupuis, Chad 2017-02-15 2272 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_UNSOL,
61d8658b4a435e Dupuis, Chad 2017-02-15 2273 "Unsolicated CQE.\n");
61d8658b4a435e Dupuis, Chad 2017-02-15 2274 qedf_process_unsol_compl(qedf, fp->sb_id, cqe);
61d8658b4a435e Dupuis, Chad 2017-02-15 2275 /*
61d8658b4a435e Dupuis, Chad 2017-02-15 2276 * Don't add a work list item. Increment consumer
61d8658b4a435e Dupuis, Chad 2017-02-15 2277 * consumer index and move on.
61d8658b4a435e Dupuis, Chad 2017-02-15 2278 */
61d8658b4a435e Dupuis, Chad 2017-02-15 2279 goto inc_idx;
61d8658b4a435e Dupuis, Chad 2017-02-15 2280 }
61d8658b4a435e Dupuis, Chad 2017-02-15 2281
61d8658b4a435e Dupuis, Chad 2017-02-15 2282 xid = cqe->cqe_data & FCOE_CQE_TASK_ID_MASK;
61d8658b4a435e Dupuis, Chad 2017-02-15 2283 io_req = &qedf->cmd_mgr->cmds[xid];
61d8658b4a435e Dupuis, Chad 2017-02-15 2284
61d8658b4a435e Dupuis, Chad 2017-02-15 2285 /*
61d8658b4a435e Dupuis, Chad 2017-02-15 2286 * Figure out which percpu thread we should queue this I/O
61d8658b4a435e Dupuis, Chad 2017-02-15 2287 * on.
61d8658b4a435e Dupuis, Chad 2017-02-15 2288 */
61d8658b4a435e Dupuis, Chad 2017-02-15 2289 if (!io_req)
b8c7dd15ceb87e Jesse Brandeburg 2024-06-11 2290 /* If there is not io_req associated with this CQE
61d8658b4a435e Dupuis, Chad 2017-02-15 2291 * just queue it on CPU 0
61d8658b4a435e Dupuis, Chad 2017-02-15 2292 */
61d8658b4a435e Dupuis, Chad 2017-02-15 2293 cpu = 0;
61d8658b4a435e Dupuis, Chad 2017-02-15 2294 else {
61d8658b4a435e Dupuis, Chad 2017-02-15 2295 cpu = io_req->cpu;
61d8658b4a435e Dupuis, Chad 2017-02-15 2296 io_req->int_cpu = smp_processor_id();
61d8658b4a435e Dupuis, Chad 2017-02-15 2297 }
61d8658b4a435e Dupuis, Chad 2017-02-15 2298
61d8658b4a435e Dupuis, Chad 2017-02-15 2299 io_work = mempool_alloc(qedf->io_mempool, GFP_ATOMIC);
61d8658b4a435e Dupuis, Chad 2017-02-15 2300 if (!io_work) {
61d8658b4a435e Dupuis, Chad 2017-02-15 2301 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate "
61d8658b4a435e Dupuis, Chad 2017-02-15 2302 "work for I/O completion.\n");
61d8658b4a435e Dupuis, Chad 2017-02-15 2303 continue;
61d8658b4a435e Dupuis, Chad 2017-02-15 2304 }
61d8658b4a435e Dupuis, Chad 2017-02-15 2305 memset(io_work, 0, sizeof(struct qedf_io_work));
61d8658b4a435e Dupuis, Chad 2017-02-15 2306
61d8658b4a435e Dupuis, Chad 2017-02-15 2307 INIT_WORK(&io_work->work, qedf_fp_io_handler);
61d8658b4a435e Dupuis, Chad 2017-02-15 2308
61d8658b4a435e Dupuis, Chad 2017-02-15 2309 /* Copy contents of CQE for deferred processing */
61d8658b4a435e Dupuis, Chad 2017-02-15 2310 memcpy(&io_work->cqe, cqe, sizeof(struct fcoe_cqe));
61d8658b4a435e Dupuis, Chad 2017-02-15 2311
61d8658b4a435e Dupuis, Chad 2017-02-15 2312 io_work->qedf = fp->qedf;
61d8658b4a435e Dupuis, Chad 2017-02-15 2313 io_work->fp = NULL; /* Only used for unsolicited frames */
61d8658b4a435e Dupuis, Chad 2017-02-15 2314
61d8658b4a435e Dupuis, Chad 2017-02-15 2315 queue_work_on(cpu, qedf_io_wq, &io_work->work);
61d8658b4a435e Dupuis, Chad 2017-02-15 2316
61d8658b4a435e Dupuis, Chad 2017-02-15 2317 inc_idx:
61d8658b4a435e Dupuis, Chad 2017-02-15 2318 que->cq_cons_idx++;
61d8658b4a435e Dupuis, Chad 2017-02-15 2319 if (que->cq_cons_idx == fp->cq_num_entries)
61d8658b4a435e Dupuis, Chad 2017-02-15 2320 que->cq_cons_idx = 0;
61d8658b4a435e Dupuis, Chad 2017-02-15 2321 new_cqes--;
61d8658b4a435e Dupuis, Chad 2017-02-15 2322 }
61d8658b4a435e Dupuis, Chad 2017-02-15 2323
61d8658b4a435e Dupuis, Chad 2017-02-15 2324 return true;
61d8658b4a435e Dupuis, Chad 2017-02-15 2325 }
61d8658b4a435e Dupuis, Chad 2017-02-15 2326
:::::: The code at line 2218 was first introduced by commit
:::::: 61d8658b4a435eac729966cc94cdda077a8df5cd scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.
:::::: TO: Dupuis, Chad <chad.dupuis@xxxxxxxxxx>
:::::: CC: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki