Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp801514lqo; Wed, 8 May 2024 15:56:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUK/9GjVC6vvBSH6ePWvQ94DaQFm1td2dJm3mJz7dsbWFsXwTcT83/RLuH63UfakiRaChWcpBXhy0nl8DWoQxgz1ZM+9qoBdTZaYSRfAA== X-Google-Smtp-Source: AGHT+IE4NJc9u0qZ6N4f27tDBYBpWZIhFhH4Idc3D/U39OkkCLVcCgcTN6Ik+FMi7XeucsD+tzTd X-Received: by 2002:a17:902:d58e:b0:1e5:9dff:a52c with SMTP id d9443c01a7336-1eeb03a5751mr50208735ad.10.1715209009905; Wed, 08 May 2024 15:56:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715209009; cv=pass; d=google.com; s=arc-20160816; b=o02unzVKv+z8Nj4YI8kKMyi9rHlpyrysCJBL/q95GnKOaLj4Smt+j1wdvdmICnKBdZ Ztj2dmeAp8IY86JpSZOzo5qsxPYdQkmLi792HEcG5kBqIoCZf98ivQ4beWeSvwICpbqG KSbf2M08Q3bM8B0Xq1fmbCPcgXLkpJi4ojLXuTsVVMyqlOcF5mkSD4AbZogLD8c/ghC5 5Ycy+Akfa6DUxT5yEpVe1wHFjp2dodrRkDUMoIGYKhBd1QxZcpucbRMKmVJphLkLbxgg QeYFk7LlQUKP6bbWvoRq3wto4zCfETQduY3v7efODEm4XZ5ERSgYk+bIctam6uVGz3c1 eadQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=obIaMlMHKrKu0FVtTkC/BMj1vgSpq3MvwUuo0FQA9jo=; fh=QFBDTEls3PpBlUl+JtYxt3LLDCyTHMHfFMoZlKiwW/A=; b=apSHYloSbhkRz2H/08rBEAWUIEnVV8BwMCblNdU3kKvhVrS/XgRP9hhH6oDQPy74u8 IJBzdYyVdtg9VK7dGz7XDY9esJRe0xoLm1rWzwAHtHJkMKfUcCHFSK9iA2kNO0HuGYne 0xidBk4PCjKGXW8/GiXGlebbgcgUV3fv8q0z0ofi/Atf11fshRPu0AnmGUdkhDTvsK+E 2gAvhtm2vi19lU67whxOJjgBEXPcsrjslCTTL07YtgAhK2Ns7xCcQDeE33235Iyzxjim k3pJMICKNZ1cGi9idNyctTVPK3/24KkYsgJGojVu+MI/RNZq/VLgK+1PVUIrJ5eYSUIF /Qvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BwT2gHw2; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-173731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c269b02si1290075ad.581.2024.05.08.15.56.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 15:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BwT2gHw2; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-173731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8AE25B261BC for ; Wed, 8 May 2024 18:50:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 988AE130E5A; Wed, 8 May 2024 18:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BwT2gHw2" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E884912FF73 for ; Wed, 8 May 2024 18:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715194161; cv=none; b=BNY+AW49zMlUJyw+BHaU6Se28ou+jZYCaseNd9QYKA3HdOQBIKLynNrQO3bQMaOB86Qw8fhsNHcWvAw1EaAcwNN1U8VM/su+UUiRY3BKauAIBMPFFMp2zMogurzSp3S+qoEn93mNof1hq8hikVDJLHq6JPCIafYu0eCvaE4VfJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715194161; c=relaxed/simple; bh=gd7PMl27AoVAQ2ia5Bgo3BitWkSsgq61mZW0eRFY/TM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e6UtF5FCMnN13Jwf2O5ARjjVOqUdzb+4bgse3lx9soihMOqm+7Rf5K457y5hrdobXeo7FIWevVB1XtwX3JlcZCoNN071L2RQBZgGhg+vMgxTuaNh/ael5l3mZNJYwEMg1GBcOqb97ESkTXRdxhleGOcdlT9xev9u+4tLbhf2u/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BwT2gHw2; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715194160; x=1746730160; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gd7PMl27AoVAQ2ia5Bgo3BitWkSsgq61mZW0eRFY/TM=; b=BwT2gHw2IpJP14SwhSnVD+GFCAPVmimoqQe6UlcEXkqiXTOP29hP744y z6ZcrBYk72B7mmP1iPpF2ZTEdnOzF8oTBbhZRb2GckeqKj5sBdqWZ/Tk0 gBRUkIzGgrUcmpQ98QSDuf28ovIW2o8kjIPadgC72X/Txw9vYQ6S68Ejp ZKyj4qd8sv+PZ8P2buBHViLkOIjT+G0iVkuQzJEOJ3LdnBlZcWtK3Wd0U b4i2U/iNjncEP+9/SXsiFcgnRW5Q23RAvtzzqJ/Pi9FyD7JEVH0afdmhF zb++CWQl7iz0GFxLbe52SoOwpH5Y+rNDloQGFKjgSO+XB4dH+g/DT88eD g==; X-CSE-ConnectionGUID: Bndd3cpNQzWMUkmP792+HA== X-CSE-MsgGUID: oQcu8kSyQK2Q2PO8jcFqyw== X-IronPort-AV: E=McAfee;i="6600,9927,11067"; a="28591030" X-IronPort-AV: E=Sophos;i="6.08,145,1712646000"; d="scan'208";a="28591030" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2024 11:49:17 -0700 X-CSE-ConnectionGUID: yUhMmsEfSPeoIoDAIhI8Bg== X-CSE-MsgGUID: 4LUFf3YBRBKx5D2fS5IBiQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,145,1712646000"; d="scan'208";a="29024974" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 08 May 2024 11:49:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BC1A3D5A; Wed, 08 May 2024 21:49:12 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Greg Kroah-Hartman , Linus Walleij Subject: [PATCH v1 07/10] misc: eeprom_93xx46: Convert to use kstrtox() Date: Wed, 8 May 2024 21:47:00 +0300 Message-ID: <20240508184905.2102633-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240508184905.2102633-1-andriy.shevchenko@linux.intel.com> References: <20240508184905.2102633-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit sscanf() is a heavy one and moreover requires additional boundary checks. Convert driver to use kstrtobool() in eeprom_93xx46_store_erase(). Signed-off-by: Andy Shevchenko --- drivers/misc/eeprom/eeprom_93xx46.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index 3f885bac72c2..18a3b534ea73 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -366,9 +366,13 @@ static ssize_t eeprom_93xx46_store_erase(struct device *dev, const char *buf, size_t count) { struct eeprom_93xx46_dev *edev = dev_get_drvdata(dev); - int erase = 0, ret; + bool erase; + int ret; + + ret = kstrtobool(buf, &erase); + if (ret) + return ret; - sscanf(buf, "%d", &erase); if (erase) { ret = eeprom_93xx46_ew(edev, 1); if (ret) -- 2.43.0.rc1.1336.g36b5255a03ac