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: 13210284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 495D1C77B6F for ; Thu, 13 Apr 2023 13:12:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCF63900008; Thu, 13 Apr 2023 09:12:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7E83900002; Thu, 13 Apr 2023 09:12:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6DFE900008; Thu, 13 Apr 2023 09:12:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AA10C900002 for ; Thu, 13 Apr 2023 09:12:41 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 54F18AAF44 for ; Thu, 13 Apr 2023 13:12:41 +0000 (UTC) X-FDA: 80676407322.05.6311C0D Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) by imf20.hostedemail.com (Postfix) with ESMTP id 5FA781C0025 for ; Thu, 13 Apr 2023 13:12:39 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=3g3kcnsZ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of 3xf83ZAYKCMwy30vw9y66y3w.u64305CF-442Dsu2.69y@flex--glider.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3xf83ZAYKCMwy30vw9y66y3w.u64305CF-442Dsu2.69y@flex--glider.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681391559; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5hl8mLgZ8vfFyAYGSuilKL0D92tfM3tv959zGBlMPY8=; b=4t8fAjHeoKteXPujG3E/bHnQUaPDj2kk2oZ+2TZAmMDO/6WhBMjmIBPcg8B64X2kQcVdqV hQqszRelDc1L7n0djH2loiMmRFEZj3HFH/i2yJ+mVE/IP+YSvpCrkzHDB/fzkLNb9h+NQP SJDXkRQnaizwMu0wbOMa5AhTJSrNJAs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=3g3kcnsZ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of 3xf83ZAYKCMwy30vw9y66y3w.u64305CF-442Dsu2.69y@flex--glider.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3xf83ZAYKCMwy30vw9y66y3w.u64305CF-442Dsu2.69y@flex--glider.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681391559; a=rsa-sha256; cv=none; b=QD6LDjDs5EPcJiJg4UNhsgEpDDs+t+f0muQ+0b1dY5f/f1a3vsAc3dI/FxIqGk4dqds5kT nE6+BD0P54KIKilWRNJCLGvEx17hN/pb7ntcUhQ/u3sdnpmmkI+EHrbGoQIiScm2r//IQB XhPZHylZDYqdxicVP/wM244nKvyzpB8= Received: by mail-ej1-f73.google.com with SMTP id tg11-20020a1709078dcb00b0093460dfa569so5425769ejc.13 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=E62gGOT5Riryrj8DCPsUrF/gXPFtB1INBl4luUTHycjDJKLI8enh3KM/OoI+SDEgsW w7+yt6sWaayuCFhsk5DJpawPWpREjwXMemI9L81mbjdz+GPC8a1rHTIA0kpWZY1tPJtu CluKXfgmzeLEpXoALkaEd06s63w/X/lGWxbLgSv8Ysnkiqu1WEuqAOYdurp3m+7m+sUM n5VyTGH4gMP07Q5iepT3n69eQq3/p9wq5m4GDnLeEoIj1BZhrq5+CCOcl2k2n5EZJRFJ HIsmFQ5/RgZOPnQ2nZ9D7HA6LiuNA8sSJHI2F02taDdpu5uc3EWBJbEtUrI2OJlTG4Ni Uibg== X-Gm-Message-State: AAQBX9c8266J52dyCbQWHqUT9QlTqFkgAuLM7kmjryTtLXf5QVuCnsiI 82t6sfTWQYbWIu11vFRA8YKcni3UVAY= X-Google-Smtp-Source: AKy350a9ouyXSsvTMFtTTTvt+/1HR6+68HAPE3D8GNHQDJB5FXfIXg3IfKHFWgMSoRb1WkwpEEN+s/qJiXc= 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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5FA781C0025 X-Stat-Signature: bfegk3q9fhwh4jdc6331zngfyi8r5h4c X-HE-Tag: 1681391559-391615 X-HE-Meta: U2FsdGVkX1+AMDBHASgrVfjOnCCx8WnAjQNTHN/nR3eg2AqOn4SRs0hKWwC+qpfQfaYE9EvG66ad9lMyQh7V4HNJ0Ch7qpNYfhBr4V5VvZdvQDhbswZrah/iFUjt+wl6C6OuPMMh3ay8e0qwiSwpgYzjvtj8hVCZ5x36mkl/FMbIPSXLUyHqsivfwsVYDVCfDHsFAPF+EeQPIPa2sIODU+bA2EySxBlTan0EDL71eE6JbtNHG+2NsftQqULurvuu3yerGHafVM+jSd4IEoo1EMn8CX5lqOhqwYLg2zAvKl2nKEUY+FnAOau6JvolenGiZy6/C8ZVa5KS7EfCwonEbt26p+BoSnuRAOfwZK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bBgbe9XRMnr/FqZYAybI0Byf3mqFB590K41W8fXvieGLhaRRgBl1+EOVN1PROsS0Hd5VTYJmakMfnSM7Q2ku+E37YPB8PZJ5zrYj+bSLjD6HkEvVXTx+luzIdjsETXB1ebmUjyWGTIAm/zHCnnwwSGY0uk9WcKPXiBbBdmJQ0vSX4OP5ki6cUpfO8FggOuWoETsZWmkxhiy5W69+ZIHAG+Uyb2XbjO/8nnDxBmBP6VuIsiJCi/1eMERTWMPpavUi7bLewOKxg/cwmR0mh1gM5hpBU6TJhuvkC5ygpnTz55MV5A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);