From patchwork Fri Feb 28 17:21:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11413021 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46951138D for ; Fri, 28 Feb 2020 17:22:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13A1A246A2 for ; Fri, 28 Feb 2020 17:22:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jXVT0aQR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13A1A246A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 262446B0005; Fri, 28 Feb 2020 12:22:06 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 212056B0006; Fri, 28 Feb 2020 12:22:06 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 101D26B0007; Fri, 28 Feb 2020 12:22:06 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id E878D6B0005 for ; Fri, 28 Feb 2020 12:22:05 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AC050180AD830 for ; Fri, 28 Feb 2020 17:22:05 +0000 (UTC) X-FDA: 76540203810.07.land95_4c6b7a3503630 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dan.carpenter@oracle.com,,RULES_HIT:30054:30064,0,RBL:156.151.31.85:@oracle.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: land95_4c6b7a3503630 X-Filterd-Recvd-Size: 4301 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 17:22:04 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01SGwhdf096694; Fri, 28 Feb 2020 17:21:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=vKPu2mMAjTiqlFxO4uxuAPCi1fYk+P4CN6J0gVfkdpY=; b=jXVT0aQROfFszL0/BeTk6T9LK8hYmrYE0EUfnEwqMExYtEpk3VI9wOg5GFilBEoHFJCK VJf/gS2Jp0SZ8G8gnDVthFiNoHNUb5K4NuUZfFmg06q3+rklhKXByqRLJ4Gx+VVTxwcU GtooBoWvePDeklqconkjQJvrPLiJzY5byvQ0B7LKMpS3N6nyodNpWAQeZB+0Y3TagfWI KOOR2YHJD/M9swWdhfi1ch65Di2Q66KGWYhTXQyRvF67KDmize0QRF+jq8/YzUxJoAU6 bCjvjyi9qtDZp5teOvK2mZVWwqR8cEM0d0/jNIas1+xiGbdUrXD5ZBSnJrkO4ZpG0EeC sQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2ydct3m73t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Feb 2020 17:21:55 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01SHEr9N156479; Fri, 28 Feb 2020 17:21:54 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2ydcsf1pms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Feb 2020 17:21:54 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01SHLm1Z005721; Fri, 28 Feb 2020 17:21:51 GMT Received: from kili.mountain (/129.205.23.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Feb 2020 09:21:47 -0800 Date: Fri, 28 Feb 2020 20:21:36 +0300 From: Dan Carpenter To: Jens Axboe , Dan Schatzberg , Andrew Morton Cc: linux-block@vger.kernel.org, kernel-janitors@vger.kernel.org, Stephen Rothwell , linux-mm@kvack.org Subject: [PATCH resend] loop: Fix IS_ERR() vs NULL bugs in loop_prepare_queue() Message-ID: <20200228172136.h5dvwvrg5yfywxss@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9545 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002280133 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9545 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 spamscore=0 priorityscore=1501 malwarescore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002280133 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: The alloc_workqueue() function returns NULL on error, it never returns error pointers. Fixes: 29dab2122492 ("loop: use worker per cgroup instead of kworker") Signed-off-by: Dan Carpenter Acked-by: Dan Schatzberg --- Resending because this goes through your -mm tree, Andrew. The get_maintainer.pl script lead me astray. drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index da8ec0b9d909..a31ca5e04fae 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -897,7 +897,7 @@ static int loop_prepare_queue(struct loop_device *lo) WQ_UNBOUND | WQ_FREEZABLE | WQ_MEM_RECLAIM, lo->lo_number); - if (IS_ERR(lo->workqueue)) + if (!lo->workqueue) return -ENOMEM; return 0;