Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3411251pxb; Mon, 4 Apr 2022 16:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDuA9zz19qH+1ylXA0MaQieG5jOIS78UJrfianrJl4nK5xi8g8xcedPA5aeTLC45S/U1x9 X-Received: by 2002:a17:907:9706:b0:6db:566a:4408 with SMTP id jg6-20020a170907970600b006db566a4408mr559155ejc.374.1649113718296; Mon, 04 Apr 2022 16:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649113718; cv=none; d=google.com; s=arc-20160816; b=TKN1RbROHsD0YtecwWg2I5ZBeHfy9VeFHLS1uRd2UXAN5LkSbOm5oI+gGudXt+39Ie vRBPw4xYSj+5GWCqXgtHtfAaF4LFwBuHAXzsNWPtxflpjxExApA9PU20QcTwByt/8cvd aMXz96LS02W1IsxIMIQ3FWChl7jn79375lu1lY33EPgOWHlQJ4hCML5BzVfT2ufgWWNW YJa3D3M9Bktaq0BoboCVndK5+108ux75MVP/am0rJHZ06FRyHysPzUmSZF5QtaSJVPoY XRfIvpHCqEhDO+PMhQk9jQyLQwpCtUj8uHh8uAxSI8EJIna/hFvtBjt6pm91cj1XEvvH 1R+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=15hcCIpQC0VqBDHPsAp6yPhi35cw6G3wETqd2cbLIoY=; b=rXJlLPXEnxSrUce9E+h93t/n9ajzWA4OpTtcnN1QRCnCIIc0z9OHodgppHv2Kd/1sO Abxd0IPyK1asz2QA4PaV4h2wxoXVwJrMU2Dwp5WHVMfRFudkK0uN3+rVpfuIYn1eNZ64 jaTNZquh3xyTNm4asHq5koOvjgjRpjRMzuq4ww4c0RKrTV6/IdkQ2mHRhiiy5TEeKJE2 k1P2Yafn4Lw0utcV+OsqXfzVFY+L8E87bLv8hAhA5y98gEUTMyfMXw4wHAbzhlkFn/g4 kUQKO6g5UAakKOwwKZi8w8s/4KKl91aDPFHD2B5UWGTL3q1bOm7nbFTR9s73lhVUtM16 SgGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Wc1Hwmen; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a056402275000b0041080b4c683si8599656edd.0.2022.04.04.16.08.12; Mon, 04 Apr 2022 16:08:38 -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=@google.com header.s=20210112 header.b=Wc1Hwmen; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233242AbiCaSG6 (ORCPT + 99 others); Thu, 31 Mar 2022 14:06:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232396AbiCaSG5 (ORCPT ); Thu, 31 Mar 2022 14:06:57 -0400 Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29FDB1B9885 for ; Thu, 31 Mar 2022 11:05:10 -0700 (PDT) Received: by mail-wm1-x34a.google.com with SMTP id h189-20020a1c21c6000000b0038c8655c40eso150599wmh.6 for ; Thu, 31 Mar 2022 11:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=15hcCIpQC0VqBDHPsAp6yPhi35cw6G3wETqd2cbLIoY=; b=Wc1HwmentiHv/fZuGFoLTitGkoma0Q5v01UFXMR7/jicGlIN4bTu6dLbZZcrqP/mdO SHe+9LAq+3wxREIb8cGnq4EXg+wo0+q+w+6NGCQCeXBvjbMoHmn1VFYqgXwX9U+R2dcx NTuUV3WQHqsFt3JmpdPEYvhVbviL1S+ED005wJ5tY26C+RHq5feJBxI8Th8BsWYX7NiC 2Z6sJ6fxESSv2NFx+jRbtvHoDBgNlzpgKSeW1zxNiZVe9pjyNYn5QWUJqdteJvw9QNeu d66rz+8umDoB55OjgrpYOKIZ/VTaXlkGoA8ugqBbXi415tGEdkYA2IcbG3R2BfazgfMr BG5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=15hcCIpQC0VqBDHPsAp6yPhi35cw6G3wETqd2cbLIoY=; b=cFRogckj7bwVNeFri/Vwj9g7Fi21PbEHrTsrQddJD8Y594CMZwAzUGXFFtRgUxD8Ma 7fyeVuank8AI5t/QhFGC5sCww4owCFXdLyqBwoADY47M8bqHYeor81h9aqjm5lcd9rFM iMCPljMPY1xp4G762VmjdiXe6PQ1kA5KvlDWErAbIXh5K1RwKXhWG7Pp3evsxY+/PNwO +wuaWBsW2aMMHXQHSgn5e4obF3oqFRYHqBfFR3rjHewEpbSiKuF/GJayfjgJ0AgwNFsa AsTgMZtm6IOzBfHpXf7HZZDPT9eOKjDYUUUJjZ2T+NFW+ZncoQJJpAPG5rdbn6Ne9HBq ecVQ== X-Gm-Message-State: AOAM5330hWK4bvDBsL38zcOCdHJAE5ddzjjUMStPj9xPGzLo4dRdRtbk feVOH4bF0AkrxejmcsWw0wdeR8ecq1I= X-Received: from nogikh-hp.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:200d]) (user=nogikh job=sendgmr) by 2002:adf:f78e:0:b0:205:85d3:fa33 with SMTP id q14-20020adff78e000000b0020585d3fa33mr4966519wrp.675.1648749908645; Thu, 31 Mar 2022 11:05:08 -0700 (PDT) Date: Thu, 31 Mar 2022 18:05:01 +0000 Message-Id: <20220331180501.4130549-1-nogikh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.1094.g7c7d902a7c-goog Subject: [PATCH] kcov: don't generate a warning on vm_insert_page()'s failure From: Aleksandr Nogikh To: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: dvyukov@google.com, andreyknvl@gmail.com, elver@google.com, glider@google.com, tarasmadan@google.com, bigeasy@linutronix.de, nogikh@google.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 vm_insert_page()'s failure is not an unexpected condition, so don't do WARN_ONCE() in such a case. Instead, print a kernel message and just return an error code. Signed-off-by: Aleksandr Nogikh --- kernel/kcov.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/kcov.c b/kernel/kcov.c index 475524bd900a..961536a03127 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c @@ -475,8 +475,11 @@ static int kcov_mmap(struct file *filep, struct vm_area_struct *vma) vma->vm_flags |= VM_DONTEXPAND; for (off = 0; off < size; off += PAGE_SIZE) { page = vmalloc_to_page(kcov->area + off); - if (vm_insert_page(vma, vma->vm_start + off, page)) - WARN_ONCE(1, "vm_insert_page() failed"); + res = vm_insert_page(vma, vma->vm_start + off, page); + if (res) { + pr_warn_once("kcov: vm_insert_page() failed"); + return res; + } } return 0; exit: -- 2.35.1.1094.g7c7d902a7c-goog