From patchwork Thu Aug 17 10:41:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 136106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp1950789vqi; Sat, 19 Aug 2023 03:41:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQUAgWmNr222wy+9NyAENTpG+KfxGX2V1YT2fnLpzyPbuvcYRU5zE54uej00yYVxdPwP6y X-Received: by 2002:a17:907:7818:b0:9a1:6d6d:f259 with SMTP id la24-20020a170907781800b009a16d6df259mr1192257ejc.53.1692441685432; Sat, 19 Aug 2023 03:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692441685; cv=none; d=google.com; s=arc-20160816; b=u8wRz2FFKf25WRjjq6Bb1fPqL5MYt845NlJ4ShC1aqyN6fEo3cqcZcDo4osiZr4+rH R2RtqwUnG6reoJvPxha/saWq3qCnPoydlSqW5a9RNgHY2IwbxR1Tt5JJeZTntFiHy4k+ +pTTAjV/k+UbUxOYp8Ufy7OySCtv3ztkfwce9s5t3xasPyylDUnNFNZWiGGh/lgRX/w1 gycCzO8WPFIaRTj4MHGMUL+YvH5FiclDg7EwwAeLMgxkWBMvG48CdTaE/M5Ii8D8CO+l 4NL5INnpwfxev0mEkCN7avp5EbtSlWaL8t4qxw51Fy6T5L64lMc8rlu4ox8HVFpWMtJr m67Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id; bh=E7abKRbESXhiG9ajs67FNBn7Jgv0sFZu+GDyuz/7jvQ=; fh=EWHWs/u0cGaCJKRQ/WY+GfZC8cPfyvdtT40NL6WK9aU=; b=jw5Ha/yIwjSYSUXswv326yZehzdgybSST/4NP32embk4Jp5MtS7FL4D+ZDPOXVdofv CGCWrNN8+NF7PBPgztKrv7kMTP1/ONCB3EySk2XiRyzHkfp2My0CCW6EM5bwwx12mw3d uTbYunUYImiJEce9U24pddZctC9zu6xHAdZU/juYs9bNpaPpSNVrhXQkEVWO1GjsIoiG j/yE5X5jYl2BJ3OKo8I3i2/PiefgTqAQS5g+rpmYzy78Wnx2sBxphnW5bEiqfmfKwS/x D3dI44kb//Yx3niu9PVoHtekwOs2pzyqTYJydlmilz409QPF9LcNhb8malbw77o1Ii6Y E+Lg== ARC-Authentication-Results: i=1; mx.google.com; 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=xs4all.nl Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a170906579100b0099da220412csi2847491ejq.1053.2023.08.19.03.41.02; Sat, 19 Aug 2023 03:41:25 -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; 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=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349997AbjHQKl6 (ORCPT + 99 others); Thu, 17 Aug 2023 06:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242143AbjHQKli (ORCPT ); Thu, 17 Aug 2023 06:41:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68C52D5A; Thu, 17 Aug 2023 03:41:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B97E611D4; Thu, 17 Aug 2023 10:41:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A568AC433C7; Thu, 17 Aug 2023 10:41:34 +0000 (UTC) Message-ID: Date: Thu, 17 Aug 2023 12:41:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US, nl To: Linux Media Mailing List Cc: Marek Szyprowski , Tomasz Figa , Linux Kernel , Jan Kara , David Hildenbrand , Linus Torvalds From: Hans Verkuil Subject: [PATCH] media: vb2: frame_vector.c: replace WARN_ONCE with a comment X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774652391524274395 X-GMAIL-MSGID: 1774653732812924370 The WARN_ONCE was issued also in cases that had nothing to do with VM_IO (e.g. if the start address was just a random value and uaccess fails with -EFAULT). There are no reports of WARN_ONCE being issued for actual VM_IO cases, so just drop it and instead add a note to the comment before the function. Signed-off-by: Hans Verkuil Reported-by: Yikebaer Aizezi diff --git a/drivers/media/common/videobuf2/frame_vector.c b/drivers/media/common/videobuf2/frame_vector.c index 0f430ddc1f67..fd87747be9b1 100644 --- a/drivers/media/common/videobuf2/frame_vector.c +++ b/drivers/media/common/videobuf2/frame_vector.c @@ -31,6 +31,10 @@ * different type underlying the specified range of virtual addresses. * When the function isn't able to map a single page, it returns error. * + * Note that get_vaddr_frames() cannot follow VM_IO mappings. It used + * to be able to do that, but that could (racily) return non-refcounted + * pfns. + * * This function takes care of grabbing mmap_lock as necessary. */ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write, @@ -59,8 +63,6 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write, if (likely(ret > 0)) return ret; - /* This used to (racily) return non-refcounted pfns. Let people know */ - WARN_ONCE(1, "get_vaddr_frames() cannot follow VM_IO mapping"); vec->nr_frames = 0; return ret ? ret : -EFAULT; }