Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp2631736rdb; Fri, 18 Aug 2023 06:19:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGumGJc/ZCH64sxStr8DYq0q+BRUcOC6lf77G2eUAYBWOpgqH1ZyMOMFQ8rqckiunDVfiS9 X-Received: by 2002:a2e:911a:0:b0:2b9:ea6b:64b with SMTP id m26-20020a2e911a000000b002b9ea6b064bmr1968982ljg.37.1692364788648; Fri, 18 Aug 2023 06:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692364788; cv=none; d=google.com; s=arc-20160816; b=XJGPISIgbS+ku4oYJ2pSCQC3nIGBaoK6NqRLvuB4du8P1MfRDwVE/Y9foDl/RfJQFm nMeFZwDAWGKyL4papm/7e+nKlSD0PaMNiWsM+xca0FxTLFXQzSzGr/5zd1+LFQeYqY8y VJJpAflRfOd3YvTAlsMsMCBdedAR6eGfrGeF/BYJZTezaN7R9QNsPu7Xlf/oYk5+Y+s2 0K+BajxwiHMEYKgvOBwiAm6W77xtwDBkxenldT2f3hM5E6NUOEhgqj1pEgptnoJaLhj3 YeqQXS6npWgB1dDepIKsqjNjJPoN4/HxgwYfJimDgijsh8xZXcdDhMZJVTLNYxCpCQIA 3XrA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jr16-20020a170906a99000b0099cbdd785a2si1418202ejb.821.2023.08.18.06.19.17; Fri, 18 Aug 2023 06:19:48 -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 S1349976AbjHQKl6 (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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 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 --- 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; }