From patchwork Fri Feb 28 14:13:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11412397 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 C45661395 for ; Fri, 28 Feb 2020 14:14:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3E9A246AC for ; Fri, 28 Feb 2020 14:14:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="l0NyeqoM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726900AbgB1OOR (ORCPT ); Fri, 28 Feb 2020 09:14:17 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:60472 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbgB1OOQ (ORCPT ); Fri, 28 Feb 2020 09:14:16 -0500 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 01SEDGvL029651; Fri, 28 Feb 2020 14:14:13 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; s=corp-2020-01-29; bh=O1DUUIvuaMEGTCil85jw+U4JgdEjnEHO3zbqbhBZI4M=; b=l0NyeqoMEP4MbpIRwxZE9wltTz2qEfz3MC1bYctUI/SKQDoyqA3XC0NI6NP7WaF3JhZ/ 7eY+4ivKIXaa5SU31TA36ETqUjCpXcqOsqDLb2um3N4c7qEZ+YUZduEuHSI7bwt3wvoY U8qk6mxyQBqadxGp4L8Vmp54EToEPruwLw902xQ+jhxfzMRadsQNCWOfM2YpZj+rodbq ZebmVSmJDlbveZ6h2TYr+WbpFfLDaBaSOPfikDmjbS+jcLZLvrWYQdKQZ9xLGq5Y5rar a69NfnlN3VoTHTA4nQbuO+hSVuMCPr/bLg7S2yhOJ8sL2afdNTCl7u0FmcR0DxvqER6F cQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2ydct3k23m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Feb 2020 14:14:13 +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 01SECqpv178281; Fri, 28 Feb 2020 14:14:12 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2ydcsefftq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Feb 2020 14:14:12 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 01SEEBhg001888; Fri, 28 Feb 2020 14:14:11 GMT Received: from kili.mountain (/129.205.23.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Feb 2020 06:14:10 -0800 Date: Fri, 28 Feb 2020 17:13:50 +0300 From: Dan Carpenter To: Jens Axboe , Dan Schatzberg Cc: linux-block@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] loop: Fix IS_ERR() vs NULL bugs in loop_prepare_queue() Message-ID: <20200228141350.iaviwnry3z4ipjqe@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9544 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-2002280112 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9544 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-2002280112 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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 --- 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;