From patchwork Thu Apr 13 13:12:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 82955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1030034vqo; Thu, 13 Apr 2023 06:20:48 -0700 (PDT) X-Google-Smtp-Source: AKy350Y8v7n1Y0wGYSPjl/3eAtR6RVahvlEuGbvINf1dDsvbfid9nd/ILqQnT4N+CylWM1gEf5xa X-Received: by 2002:a05:6870:59b:b0:177:9753:f82b with SMTP id m27-20020a056870059b00b001779753f82bmr1571143oap.5.1681392048430; Thu, 13 Apr 2023 06:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681392048; cv=none; d=google.com; s=arc-20160816; b=RMMdrqy4gtqehlf6ewiN/YHahW4mJXp5u+2V2UdoQL1KtBkwxv8UtYgiP9tdPN5U/E H74wVMWRuPSvk7hnl5J7Ey2sKpMQAe8WKstClAyZgvQqrtk+4frrJVkeMwO6dWS3UsM3 JH38oU020+UhO6S3lA6kj5d85PPV/hTivddAd+CLapMPjIGd7IAapMZgJLH3W820GdkZ QW+w/zxAXFyaxSwnBPpfwrl6EYgSNhQkFRFlCfkv18LNQwqRx75fUKqyuuJO0rVxh8hD 1XfoTEQJkd+SXAY0ZMdQko5PJNXiHrDBs8M9gXZ83+6eA3zHFpK5rZQq2NTqdxY4zOpE x8Zw== 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:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=5hl8mLgZ8vfFyAYGSuilKL0D92tfM3tv959zGBlMPY8=; b=ZXpLpMAjJONE0vvQFccuQBFL/v86hEAGnFxFtU/NnvUXGX80vXxwHj9OQKDLAc71mZ LYaHMd3D9ov9z3ZJqjSP96oiI4e5JhzoV7jywB98cQXE1o+KBkwYtGPHaefN0l5se4QR oFEX5HFaa/4MliyzjIqLtl0UxQlii2Y8cxCAdkNb7dGjIMEySh3oL6dXXSqyQFiIKYT9 5ZArsnPKpL0tpybsiDfhreJGBm8zzFPbj312LJgKlcuAIe8f3nHLl0o0mHhy6AE5QN+U 47g5CCgWwnvHIds1OFOanIqaGVERwPESYfNAq8JP/kncYvG6nNefKsznFwKbHem2cOVH qqLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=3g3kcnsZ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a0568301e6900b0069f7e4f8557si1742527otr.60.2023.04.13.06.20.35; Thu, 13 Apr 2023 06:20: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; dkim=pass header.i=@google.com header.s=20221208 header.b=3g3kcnsZ; 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 S231126AbjDMNNI (ORCPT + 99 others); Thu, 13 Apr 2023 09:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbjDMNNA (ORCPT ); Thu, 13 Apr 2023 09:13:00 -0400 Received: from mail-ed1-x549.google.com (mail-ed1-x549.google.com [IPv6:2a00:1450:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70312A5F6 for ; Thu, 13 Apr 2023 06:12:39 -0700 (PDT) Received: by mail-ed1-x549.google.com with SMTP id q27-20020a50aa9b000000b00505034ae370so2883120edc.3 for ; Thu, 13 Apr 2023 06:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681391558; x=1683983558; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5hl8mLgZ8vfFyAYGSuilKL0D92tfM3tv959zGBlMPY8=; b=3g3kcnsZVl5BwzCD7l2Xo768ttu3qPYULVrQMP5xF9enWn5TBU3XzrzUhG/7hwEHQA wPLn47/ryUIDarxbfs0tE7kinLwqMnxfwdQc9Q1dUN8JcWR+QRB1dpnx08/iFWkqR2Lk NNSidDbqp2G1GtnwG23rwxGljSRZFninLhww6HZAy1DTUk234ZDJBq5flP+4WWjmWQM+ 8Uix+/hEB8gXaepnyyxnUvHwpTRRtrP74mMwqCZz1CP5JVkB4+8uXG6l4d4BkgTOte8D 7KhEZEdSO9t3ZrKdlBLF64cImCAAa1EQIUDgwpJ1BLBeNAApg6yCW8UH9Z6PPH58aN5H kJPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681391558; x=1683983558; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5hl8mLgZ8vfFyAYGSuilKL0D92tfM3tv959zGBlMPY8=; b=OEcGR5tsYKj8P6TQO5wsBYUIHTGm0JXfSjo556OfWxx2GCOMNVcW418PlIHwGXm4lg UcVhfmhiRqQj9yQy3Uo3oCRtiNrNcYi7cquDbo5ZhkkwhIvto25RsyUUer4PFMF8jM4m EjZJS+gunNnolKMuJZrAsyGbPlZkknrBJbfoUQ7yD9L/EygmowW8OTdadAegFcEhaqjS fuqlVJRBgaz7EaYfs5dx80l0NI6mEl61OVRWj+Hxyo1shv+Kp/sQeVnHhdg+vuqjZlPB NiUyLvSNCb46XwHkK4WzCq04A1OYc2KbSCNNhEMTsxkUyfIhP6YbrbaK7GBhgtvL1ECG uO6g== X-Gm-Message-State: AAQBX9cOLnlWAdYQhb1cj2tuPQHB8tyREua2NksXCEe+8FcxKXtJYqBC WQSaVHR9PTwq6/D1K4yIP10xAATdodI= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:eb2b:4d7d:1d7f:9316]) (user=glider job=sendgmr) by 2002:a17:906:3091:b0:94a:a6ac:8a2d with SMTP id 17-20020a170906309100b0094aa6ac8a2dmr1265450ejv.13.1681391557908; Thu, 13 Apr 2023 06:12:37 -0700 (PDT) Date: Thu, 13 Apr 2023 15:12:23 +0200 In-Reply-To: <20230413131223.4135168-1-glider@google.com> Mime-Version: 1.0 References: <20230413131223.4135168-1-glider@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230413131223.4135168-4-glider@google.com> Subject: [PATCH v2 4/4] mm: apply __must_check to vmap_pages_range_noflush() From: Alexander Potapenko To: glider@google.com Cc: urezki@gmail.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, elver@google.com, dvyukov@google.com, kasan-dev@googlegroups.com, Dipanjan Das 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763067348336060493?= X-GMAIL-MSGID: =?utf-8?q?1763067348336060493?= To prevent errors when vmap_pages_range_noflush() or __vmap_pages_range_noflush() silently fail (see the link below for an example), annotate them with __must_check so that the callers do not unconditionally assume the mapping succeeded. Reported-by: Dipanjan Das Link: https://lore.kernel.org/linux-mm/CANX2M5ZRrRA64k0hOif02TjmY9kbbO2aCBPyq79es34RXZ=cAw@mail.gmail.com/ Signed-off-by: Alexander Potapenko Reviewed-by: Marco Elver --- mm/internal.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 7920a8b7982ec..a646cf7c41e8a 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -833,20 +833,20 @@ size_t splice_folio_into_pipe(struct pipe_inode_info *pipe, * mm/vmalloc.c */ #ifdef CONFIG_MMU -int vmap_pages_range_noflush(unsigned long addr, unsigned long end, - pgprot_t prot, struct page **pages, unsigned int page_shift); +int __must_check vmap_pages_range_noflush(unsigned long addr, unsigned long end, + pgprot_t prot, struct page **pages, unsigned int page_shift); #else static inline -int vmap_pages_range_noflush(unsigned long addr, unsigned long end, - pgprot_t prot, struct page **pages, unsigned int page_shift) +int __must_check vmap_pages_range_noflush(unsigned long addr, unsigned long end, + pgprot_t prot, struct page **pages, unsigned int page_shift) { return -EINVAL; } #endif -int __vmap_pages_range_noflush(unsigned long addr, unsigned long end, - pgprot_t prot, struct page **pages, - unsigned int page_shift); +int __must_check __vmap_pages_range_noflush( + unsigned long addr, unsigned long end, pgprot_t prot, + struct page **pages, unsigned int page_shift); void vunmap_range_noflush(unsigned long start, unsigned long end);