Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5279322imu; Tue, 25 Dec 2018 23:10:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN5xFQpx+DAj2TwAUQfQIk4pCxO/jnosAP9oa/q730SR1sikXtwXn/egde1vke3FEws1kTn2 X-Received: by 2002:a17:902:76cb:: with SMTP id j11mr19260658plt.179.1545808205519; Tue, 25 Dec 2018 23:10:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545808205; cv=none; d=google.com; s=arc-20160816; b=0bYmMYGQ1g8Ec5Urq+trGQXs1LkoGY65Iq/1+al4BT3XCrNpO9pmQ57nt3RCHq7EdX z8zalrPf428o0t/8EQuJImx9nW5Aihx1pj/r3YZoVyCn2rHBlyWgv+npiTts1HelOC24 2Be/07m+hze1yOLH4rpsJZ0VYrQq5wutTYOBJi6aFGP0Vo5sZVEEtTbcsjO3Rb13mFuR VvXtMFQNmTwvf2WYVGzBApBSaZpzqburP9cK7ryh0wDYt9phKXnfc3rlEE5P9iHBiBSy DxS7Wtw93JEkyn4oK0Wuaf6w8NPp13WO2WIlqbPEJplqwmQ2cC5+EGu3QkXtBApFHblj DfYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/BUhnLS3W0iUtH++OCqlLSbIUCQXTYkZ1ohcju+tm+0=; b=bFxYjL+hR2dhbq4kJKFDOvWjrkEKsCKv8SVuyOwbyppnCqRtwWc0v1G9hctIm1Nl8R F/100+OyfeQ+ulpV5I8xc+W9fgye/8Ml6FBvxUrbFBeb4RaPG/Y33DtrlCJ5LAhoAxaW LOQXzxdnGKVJYkzdhIvYcvadqixuPjVaBDYPxIY/TN4VTBELyaAiJEbGA9mRdJFafIhv zX4LZ2XhX1m0isY/2g4CcU4z7nYA6uokcQ86oq4xbxIbg0vtgeYN8aoGA/Loxaxd9oCd 6O+U7YqHogEYMohp8T8HK3E0c2FMg5ITldSCEZWgAmn3zxKlZ08Lx6ylZr7gpogJYARC Qs1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=MvokJsnh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si31961562ple.389.2018.12.25.23.09.49; Tue, 25 Dec 2018 23:10:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=MvokJsnh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726143AbeLZGst (ORCPT + 99 others); Wed, 26 Dec 2018 01:48:49 -0500 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:59310 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbeLZGss (ORCPT ); Wed, 26 Dec 2018 01:48:48 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 1424A9B8 for ; Wed, 26 Dec 2018 06:48:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P9DhY42flqnO for ; Wed, 26 Dec 2018 00:48:46 -0600 (CST) Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id DA8BB9B2 for ; Wed, 26 Dec 2018 00:48:46 -0600 (CST) Received: by mail-io1-f71.google.com with SMTP id k4so18491762ioc.10 for ; Tue, 25 Dec 2018 22:48:46 -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=cQjqHZqcmcFg3lB/CpzXjOBvt9ZtE3PTaUNRWFBKKZtgXGmfUHtiwE0MmVoCHFbRiO Ng6pOcAgxKTJIk6feZpzeCWCGWhYk7tPBMbcbwrlh+IUGmbNbOZm8ou1Suw+0A5NZa4B QSl4vHGNqBXssmhrpySPenDILAUR9Z3TtR5VFpZCtVwBZutftIG15t4xrLvcvmf28mHK pe3aJbZi2SeYebrGZLJS/2mx47w8UilHQdhkMsF1P/FfPJLrDcEjH+p/h3eW1SOaNjup AXOTjvbtfB3sLeRxcVhCOJWEkREE900rUO4VM1gVsIfhbs3W/aHb83MkuWUJpobOW7Ii j+dQ== X-Gm-Message-State: AJcUukd/209wpWVN98yZvq4Zh/AM1TqqY/t/LS0JT8RTtIkWanmi6SIe XH9Dx3QKy9vLwbM+LX1SUJL50ncaKEs2VGsvBz8CHN1NV93+sNSPWCi1aW4Q9HfRNCOmx7pUPW/ oN9VLUjljKSl3G1z1jBC7jTe4gGKn X-Received: by 2002:a6b:f404:: with SMTP id i4mr10399423iog.281.1545806926323; Tue, 25 Dec 2018 22:48:46 -0800 (PST) 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.17.2 (Apple Git-113)