Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1770882iob; Sat, 14 May 2022 20:39:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfNBdyiUwNv7EQ04mY78YntxRhyQj/qOljSt2uCY39oBUk2yY9fAboJdZiL/FtDleRicST X-Received: by 2002:a5d:5950:0:b0:20c:4edd:6d88 with SMTP id e16-20020a5d5950000000b0020c4edd6d88mr9319494wri.441.1652585972200; Sat, 14 May 2022 20:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652585972; cv=none; d=google.com; s=arc-20160816; b=qfm2J9OeMUUcjTz1952emmO2VKE24rtFqxqHkgbsYz1ASTv0RtJBuAbYzTBeL68rGU d7m9ySp8I7A7w49bqoIQluVx8gPrwv+whaPCAuiaBn9PENa4R3NMuKj2SkXpF17MfMVx A46kIN69TomxWUP6RKUt3GPMXbsiVfo+C9sisJw7IbpWtJGLPK29g8/9j7Y1dOU0uRyV fgjJu3IN9zVlCyRo/igvKskLVX4qJdFaB2CeuAg/HPFAWAw+5Eemqh9tsnTK9QxBHsnr HgcdeytVm77v/0v/ovj3ya9rwJZDkAEnRGmbfeFdliD4EkOikxb7IpqbvyftCo1p595M 5e4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id:dkim-signature; bh=W5F0uGwuAL8pTZ+Hf+pCcDwDg2tH8pzMKHWva8EgvhE=; b=HirGRC6591nOBDqwROKZQnlsDl71LrG+MRmp2KSnuavJTIkq+v6Ssc1Tc2Lczzef/i q3sasHDc7jbVub/YQ5tdwAEWCNqrFn8bA74kNwr2RutxxCTqCuQTqGnDDvG9quR2+PmO 1ItwDVyzNO/RqOqVDsu4ycW5twJ7FkseTV7tpKNhIezhKyj73iDI5rVnbBB7mbfI9j7u SnTOMUTThQwUELu5bqZi7/tBiZFh7b8XXJlhyx/QxH7l6fZ+76ungSHamb0KSC8Id2k2 MmHB7bHmCzMra0A9yQjBmLJVy5/K/892/zQArJHcBTOSFOMVeBCPT7yQmGHSprcWyhzC zILA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=zCqSFU3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a5d5148000000b0020a87c75b3csi5777798wrt.472.2022.05.14.20.39.06; Sat, 14 May 2022 20:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=zCqSFU3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234156AbiENQXh (ORCPT + 99 others); Sat, 14 May 2022 12:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233985AbiENQXe (ORCPT ); Sat, 14 May 2022 12:23:34 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DAB2CE2D for ; Sat, 14 May 2022 09:23:32 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id c24so9795819lfv.11 for ; Sat, 14 May 2022 09:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:cc :content-language:content-transfer-encoding; bh=W5F0uGwuAL8pTZ+Hf+pCcDwDg2tH8pzMKHWva8EgvhE=; b=zCqSFU3L2yPqDpA9e6zkSdFzMlewSbDHui1YgNVZgkEOYdLOoLz3x7AsC+W2olBLwt IThcy1Re3FAhxcn/Tl75bzDyYHshYQx05ySzBpWntoqEYwEJYqiFUvEcTIeAijtIz0MM 8Q4gOzHipiFNoWRdcrvQWkpNy1W4/xFgddUVDg8/gb5nwpP4g95HpB5VKSiOJtl/Xyed CQbtMh9HQUQlCqqrGfPPW4b12dfTsuPubqMnXjg7TdmTo/gR2WfAKyFTFZaqdVnsx0Nv zsv4pUR8DUIOTWwXceE5IVzux5Yo7gLwP7z8I6Ee0TsAP5DFjFudWpvTkJ64F8ZIjNLY VaCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:cc:content-language:content-transfer-encoding; bh=W5F0uGwuAL8pTZ+Hf+pCcDwDg2tH8pzMKHWva8EgvhE=; b=ZgV2EP75DnQbrP+KJoEUTG0qOUz68V9wOsnFI7Khtu4xEQg8iZTHUXBXDM5paac6dm GzZi4ZFjkYlwGU8U+NNBakSqfgN2NZ2tYDyPhM0ucVG9iYK12SV3sbon8nNAiXSqh7lm lVaAha5TTSEf9MyjuJ1sOdWBep5EWKhrJ5rIaoFTxAIeWoH7ctO2T/Yl32PG/T827zLK u3d8VnJEYcv8FPNpGxVAzi19SiMgyztQ7sqTdLLVQgbgoPnw/49qUYbaBN0QQPEBjjL9 GPNV5neD0yElfTrx7rMrDYoYEFFa07CoI1nV+fwQGmyHA/oMzvTtUBGBP0cLuIfoyBaL niRg== X-Gm-Message-State: AOAM5316pY0sHOv19N22kkB2b8fzy0Bhsd8IqUTp3IT+G43scyCDNJGI Cks2mxBbLNHBvSoLpSdNMWaBaXfiFwwIww== X-Received: by 2002:ac2:5237:0:b0:471:fe52:9a82 with SMTP id i23-20020ac25237000000b00471fe529a82mr7133701lfl.624.1652545411030; Sat, 14 May 2022 09:23:31 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.177]) by smtp.gmail.com with ESMTPSA id p23-20020a2e8057000000b0024f3d1dae7csm891077ljg.4.2022.05.14.09.23.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 May 2022 09:23:30 -0700 (PDT) Message-ID: <45e8576e-5fcc-bc52-8805-0b5cc3fc1a84@openvz.org> Date: Sat, 14 May 2022 19:23:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 From: Vasily Averin Subject: [PATCH] sparse: use force attribute for __kernel_rwf_t casts To: Jens Axboe , Pavel Begunkov Cc: kernel@openvz.org, linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar , io-uring@vger.kernel.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes sparse warnings: fs/io_uring.c: note: in included file (through include/trace/perf.h, include/trace/define_trace.h, include/trace/events/io_uring.h): ./include/trace/events/io_uring.h:488:1: sparse: warning: incorrect type in assignment (different base types) expected unsigned int [usertype] op_flags got restricted __kernel_rwf_t const [usertype] rw_flags fs/io_uring.c:3164:23: sparse: warning: incorrect type in assignment (different base types) expected unsigned int [usertype] flags got restricted __kernel_rwf_t fs/io_uring.c:3769:48: sparse: warning: incorrect type in argument 2 (different base types) expected restricted __kernel_rwf_t [usertype] flags got unsigned int [usertype] flags __kernel_rwf_t type is bitwise and requires __force attribute for casts Signed-off-by: Vasily Averin --- fs/io_uring.c | 4 ++-- include/trace/events/io_uring.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 91de361ea9ab..5ca4a6e91884 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3161,7 +3161,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) req->imu = NULL; req->rw.addr = READ_ONCE(sqe->addr); req->rw.len = READ_ONCE(sqe->len); - req->rw.flags = READ_ONCE(sqe->rw_flags); + req->rw.flags = (__force u32)READ_ONCE(sqe->rw_flags); req->buf_index = READ_ONCE(sqe->buf_index); return 0; } @@ -3766,7 +3766,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode) req->flags |= io_file_get_flags(file) << REQ_F_SUPPORT_NOWAIT_BIT; kiocb->ki_flags = iocb_flags(file); - ret = kiocb_set_rw_flags(kiocb, req->rw.flags); + ret = kiocb_set_rw_flags(kiocb, (__force rwf_t)req->rw.flags); if (unlikely(ret)) return ret; diff --git a/include/trace/events/io_uring.h b/include/trace/events/io_uring.h index cddf5b6fbeb4..df4b89a79764 100644 --- a/include/trace/events/io_uring.h +++ b/include/trace/events/io_uring.h @@ -520,7 +520,7 @@ TRACE_EVENT(io_uring_req_failed, __entry->off = sqe->off; __entry->addr = sqe->addr; __entry->len = sqe->len; - __entry->op_flags = sqe->rw_flags; + __entry->op_flags = (__force u32)sqe->rw_flags; __entry->buf_index = sqe->buf_index; __entry->personality = sqe->personality; __entry->file_index = sqe->file_index; -- 2.31.1