From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59711C433E2 for ; Sat, 5 Sep 2020 21:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F43D2083B for ; Sat, 5 Sep 2020 21:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L921zxqo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728449AbgIEVs3 (ORCPT ); Sat, 5 Sep 2020 17:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728647AbgIEVsY (ORCPT ); Sat, 5 Sep 2020 17:48:24 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EACC3C061247 for ; Sat, 5 Sep 2020 14:48:23 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id j11so13127067ejk.0 for ; Sat, 05 Sep 2020 14:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DYBzKs+tjeN1qZ6+Mf5LCNqQaCahpZmYn7vGp1+TLBM=; b=L921zxqo70R+rOUdE4YCwLoK0ML08oC8B5pRmn81XEinJXf9KmIq4XwxHoYMXq6WDC hk9IpnbpEFFLG9k8TTSDjSQJJ3GHNoYHMLGdhqFq2KQHiZssap+JRpX9/QvsRrCqufp7 FgF4vYRXoZbIbIroLLrdldBNtg3sVtRVldyVSRjp2LzhQnQELXK6pWgbvx4IJJnMv9vk fO1ubODrxZ8UighdMehCYh0AsepqXJAHZ4+CBrZAtuzH7YM6qhQ6TF2jA++FFP5N3Zp1 PEPj4fb/Bf7YrRGDqmC4CLio91H3wh4DXDkKIJ/Z9/vLRINwz/xlYfTYMsjrXwVINYDL c2Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DYBzKs+tjeN1qZ6+Mf5LCNqQaCahpZmYn7vGp1+TLBM=; b=RZA9rHwRE4uoTeYo+Sukcz4h+egCDYh1ksmuwie0U9LvgXKAlHKJgprlPXgEY8NEn8 4Psu5iLgd5JHe2cQeDi/EW/HlF6YVtMwA6a1KQqOskyZI6sG/9xYqXcFauW73WXlprTo P5MFAbrPChrOWkFb5WCCXCpCE8vqa4RLQrneJ0WZqz7wqja6aSFxYNS2ZaujJOnscciH WUVaMWy5kZYsalET0Rs/tTsbmFM+nXzhcPuXKUXrbX2FcQmvsNe5uhT1ME2nYkbBmmBN 1nIm8/MTL67gpL/+za3VBp9j4mWEweveusW7uEMyLMDkgQPotnySWk9WMJTdMCWG+rF7 bE6g== X-Gm-Message-State: AOAM533NjnXQFoSBw/CFUQqTeHpwDhNW7WLr5wKKL/B+Vkh4QjRJUbHz +8XnW+2XUEjqh9ywtRQUZWwNII7zqko= X-Google-Smtp-Source: ABdhPJyXgvsqBvNwSmV7nhUg91KWoWqGXlDQOO2Fa2WNHUMH4JoNpUFobaMF27P9SPFxawoTqLQarg== X-Received: by 2002:a17:906:76c7:: with SMTP id q7mr14531388ejn.541.1599342502589; Sat, 05 Sep 2020 14:48:22 -0700 (PDT) Received: from localhost.localdomain ([5.100.192.56]) by smtp.gmail.com with ESMTPSA id g25sm7965603edu.53.2020.09.05.14.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 14:48:22 -0700 (PDT) From: Pavel Begunkov To: Jens Axboe , io-uring@vger.kernel.org Subject: [PATCH 4/4] io_uring: kill extra user_bufs check Date: Sun, 6 Sep 2020 00:45:48 +0300 Message-Id: X-Mailer: git-send-email 2.24.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Testing ctx->user_bufs for NULL in io_import_fixed() is not neccessary, because in that case ctx->nr_user_bufs would be zero, and the following check would fail. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index fc2aaaaca908..2e3adf9d17dd 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2587,18 +2587,12 @@ static ssize_t io_import_fixed(struct io_kiocb *req, int rw, struct io_ring_ctx *ctx = req->ctx; size_t len = req->rw.len; struct io_mapped_ubuf *imu; - u16 index, buf_index; + u16 index, buf_index = req->buf_index; size_t offset; u64 buf_addr; - /* attempt to use fixed buffers without having provided iovecs */ - if (unlikely(!ctx->user_bufs)) - return -EFAULT; - - buf_index = req->buf_index; if (unlikely(buf_index >= ctx->nr_user_bufs)) return -EFAULT; - index = array_index_nospec(buf_index, ctx->nr_user_bufs); imu = &ctx->user_bufs[index]; buf_addr = req->rw.addr; -- 2.24.0