From patchwork Wed Dec 26 06:48:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10742849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E51DB13A4 for ; Wed, 26 Dec 2018 06:49:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60F56284F0 for ; Wed, 26 Dec 2018 06:49:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54ACB2868C; Wed, 26 Dec 2018 06:49:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5923D284F0 for ; Wed, 26 Dec 2018 06:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726054AbeLZGsx (ORCPT ); Wed, 26 Dec 2018 01:48:53 -0500 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:51604 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbeLZGst (ORCPT ); Wed, 26 Dec 2018 01:48:49 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id 7DCF5ACA for ; Wed, 26 Dec 2018 06:48:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RbnGUWnbohqc for ; Wed, 26 Dec 2018 00:48:47 -0600 (CST) Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id 4DB8AABF for ; Wed, 26 Dec 2018 00:48:47 -0600 (CST) Received: by mail-io1-f72.google.com with SMTP id t133so18432875iof.20 for ; Tue, 25 Dec 2018 22:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=/BUhnLS3W0iUtH++OCqlLSbIUCQXTYkZ1ohcju+tm+0=; b=MvokJsnh+yViCOcjsXyGwcGZxOBb2nJ3DMfyi1GXq/5wTe67QtnHOJ7VTuBRiqeNNw poI/Pf6kZa2SDaMF8s02vPA2t5ECpWTICx09IRC/XsDzgB0QwixgRFSVRKUY6tzrv8J6 YAu+qqoH4xmaZ0LIuf5R1i7hRRB02IF473lguDMYytvvo+4POKU6gptV37mKQYcl+Y/T 1Hx6UrX38y1ylPQcVVODHgcsEz3l0WHrQGkoYw53eu/Lfx+lSWRhzu62pcXYZ6ONWn51 ogNApftOaY+pmtji53mwF5c1+7a0N38lJYGfvSKJIYIQEQRchNX0uA9w2zt4kMKlHhRw TFhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/BUhnLS3W0iUtH++OCqlLSbIUCQXTYkZ1ohcju+tm+0=; b=MiUcz83hNGwh7n2iHQbIbR1ySgJZl4ohBmjQBNFv1M5Sszi2b2jxHMK7G9Npj7zp+q q82ldA7yWUxcLaQAApHwo2uprx84cgJky03ZNrSUzf7recwGLh2acGAYhnLKVjmfhp4Y hTXRoL82QBpo9/Ucz8IK/28ObpiGuYQk9UFdkPaMGNXCWGDzo57fxuurz/Nw9bMpHFAW 6iT9IqCBMsLrWeWCKutCO/5L1RedPjdvlDzKbFBwMj54Ojbv1ckZlYpXRUtaFzgZlorn A5DIFtffKMmC8ahakVKt/vixAwLFxPjIMLpY/Wbm3MKwbi7KFErrRupFY0vW6VO6aQFt bGow== X-Gm-Message-State: AJcUukcpsB4lwzP1hfRAk+ZTak+qHmzDWF7b02uO8eNyvyL7+v/b6zKe 2Of3S99wg9yzEN+QByV/bWlQxwwlcgGFVY6yIO6DpGFzsmJhIdhD1DC61zJUTRIgniUOCRahH8g 48U/Rn12Jx5MkUt90YXycnALy6tD3 X-Received: by 2002:a6b:f404:: with SMTP id i4mr10399424iog.281.1545806926323; Tue, 25 Dec 2018 22:48:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN6sy3Yrmle+GtjzzoO7/WyaKy9x59D7Itp05PTW2oCTiE1J/w8UYOTH8XqXhTOwQ2k1JK06jQ== X-Received: by 2002:a6b:f404:: with SMTP id i4mr10399414iog.281.1545806926110; Tue, 25 Dec 2018 22:48:46 -0800 (PST) Received: from localhost.localdomain (host-173-230-104-22.mnmigsc.mn.minneapolis.us.clients.pavlovmedia.net. [173.230.104.22]) by smtp.gmail.com with ESMTPSA id i78sm11948467itb.6.2018.12.25.22.48.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Dec 2018 22:48:45 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, "Nicholas A. Bellinger" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] target: fix a missing check for match_int Date: Wed, 26 Dec 2018 00:48:18 -0600 Message-Id: <20181226064818.75984-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.2 (Apple Git-113) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When match_int fails, "arg" is left uninitialized and may contain random value, thus should not be used. The fix checks if match_int fails, and if so, break. Signed-off-by: Kangjie Lu --- drivers/target/target_core_rd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index a6e8106abd6f..3138123143e8 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -573,7 +573,8 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev, token = match_token(ptr, tokens, args); switch (token) { case Opt_rd_pages: - match_int(args, &arg); + if (match_int(args, &arg)) + break; rd_dev->rd_page_count = arg; pr_debug("RAMDISK: Referencing Page" " Count: %u\n", rd_dev->rd_page_count);