Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp984081lqs; Fri, 14 Jun 2024 11:04:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzWofkyqdiS0jod66iSVx2PNqO0eD8xLa8xvoGBeBwGBtoGpg5qdSbx1bZpc1DUApgySrh9DsdZkQdvFfU3AqGYA80Fumr2WyA3J5RLg== X-Google-Smtp-Source: AGHT+IEOZGIjr6hrsOg0N6LMhpimj/BOTjGkKgirB4UT9qz2q8POc/8g4WxYM/25f3Co2SMnyxBx X-Received: by 2002:aa7:8b91:0:b0:705:961b:5f95 with SMTP id d2e1a72fcca58-705d7104715mr3356099b3a.6.1718388281995; Fri, 14 Jun 2024 11:04:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718388281; cv=pass; d=google.com; s=arc-20160816; b=Rj5DRHwi0CUBNbR0jvf7WNn3znsTs8WeOfCAkl45HXucd1fnbqlJjWLMDU3todFSF/ jbQZFZ8c3Z5lZ8mZf422Iw2PzRWXCr1+Xc9eOqnXpLSaOpBAobg3ms5Os/zzzaPPdwn4 qj8eOJyMTfom1zDUG7+pIVLkThezFHb46s8eU3Gk3ekzjCrDnrozZGl6+ixFO0Tkz+0v EkiIkvfC9xX7pehVeVlmNynPPNLC5oaQCcPTcmoAEMeae/O6E9S3RU9Q/A1wFeeUxNhf ZsQ7LqNgFRyvKjwsZspQjmDGqqQ23/2/MSs2NxDeehsyslEjiPlHY2RTBiwv5IU2geT2 JFhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=9aAn+dyPFDj13W9kA9p8UoX5UEoPcAwL160WAxAoG68=; fh=rMPlR+tt/5SbRiZRZY+MqFSaAkDD3XUrexCwMm06mfk=; b=xxeNaNHJ+RQJPa+FUAOEMwFBM/H5UTeSm22TfJvN99G9xSjA3W+UovdtAMxVUaIQl/ dWak1D9eOLSUefSoKvRnTdkSTEUsDxuDlWmQJyVGAaFdb7MB87PE7vHrJSrhXERbF1HD BWrG8hLfJB2arNnYAzePlD1oi47uyxtb1ON0WPZIiZnsCLjt3bbXPgOHTV1JWLtHv2ol 2t4caJtGtY6ClMu3jTJcJ6uLN8cvHTZ62zciUsFrJ/QqclzD7822audJ58dWTpGz4IHh oooVFIeek06htZN72Wa2Xolcla3Qb5H9fQ6+hIZ6t7QFYd+oxKA5bIY9rAAYDGE6Divv zkoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JMtBnXml; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-215358-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215358-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-705cc8fa023si4027903b3a.63.2024.06.14.11.04.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 11:04:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215358-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=@linaro.org header.s=google header.b=JMtBnXml; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-215358-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215358-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 C9A29B2BA1A for ; Fri, 14 Jun 2024 17:32:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6142119FA8D; Fri, 14 Jun 2024 17:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JMtBnXml" Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 894B620E6 for ; Fri, 14 Jun 2024 17:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718386307; cv=none; b=sgbd7LDgvNUxPwfMCJawMwkbo8BttX+Mt0edS0ZkVdIW4sDl1Cpjf7S5sKaB1KOJcLORRyUZpE5+WE4qGrpd7/kmaE0o8q2cBdyfUF7wF5XHqIySPLuNt0tkVXv7C56/QnU7h1wcrxHpDpExbE3y7vnUiNUlBiJZECXZ70dK+4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718386307; c=relaxed/simple; bh=BSipHlIgDvAU9jtI+0UzoGnMftxvZb9NU2THa75rZr8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Ht4kojvhi4FI+ndV7IBLtLNWwqin0iXbs+BnCbmhDsEDOKdqrcGx51QLKWaQa7UbBq3IAAQ7ZD2/MyG+1od+cQ6sfRTkisHY8i5xNKquhTukmzwELbbh9Goq6GaD25GU7hRi3BQhrE4kJTroxenjdDdLck4B2JWDtvWFam3JT0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JMtBnXml; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-421820fc26dso20230575e9.2 for ; Fri, 14 Jun 2024 10:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718386303; x=1718991103; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=9aAn+dyPFDj13W9kA9p8UoX5UEoPcAwL160WAxAoG68=; b=JMtBnXmlPkwAZGeP120iN5JmDE7dBxPvv/O/r4PZ2EtSpsOvoafQjb4HqXugYmIohg 7+oTb+Ca7kqtML11aUm0WEpcHAaLSjAOMqb4prFAJIkZhACXOM+53Ddd3Ts4TyaXaTkC J6482p/iPzmWQNq2Kg92AT7omsUN7jj9CMnZ/Fw5XTOk6lNh9cfXhmBgg1VmFRgv6a/I pldcPbi/usSIM5+5oWduSQ4SvKD3kS1/MVzno12JCJs/jYFedMRZPoigT8V9cIRA9OVv lZpezaREi8rlC4/sSo4dox5JVNE0/9KIz1YXUSoR3uVTeK5Di8xLHbFXUSPtcrzIAc/P x4dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718386303; x=1718991103; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9aAn+dyPFDj13W9kA9p8UoX5UEoPcAwL160WAxAoG68=; b=e4CT9+Uf4dv0Tr3D3Q0bJrtpMf/j9v9s1pWnuCawhVIKecUdQk1E/jNwz0hBDppkXW RwLdJIeHLHGv2YnQ///yqMWNVaRM+VpkRcnGtctQ7RUiqIxe8xCqyXxIQ8dAr3vCqPBE QHkE/xFHqSKAHjtvXkjt77lK5DZXc0N7XrNY3Y6nmQ8nWJvgUnRNnFy/PWA2xOztw+9I 6xfDr+mfdNRFpnmrhHhNjpRSY6FeMeUlVY+KYqFOuOFYAoyeQR0XmLKjQVF9XQXfGCmV ISaD5E6mVwYfMMyB/XEFEl5j+lqDqnXaG63LvHe4AxvhNe2H31CDZyTiacBTfy7InULv nsuQ== X-Forwarded-Encrypted: i=1; AJvYcCVwGIXUiuLtf7rvxhstYS/Iv6MYrqJxqlvsSclQhE2RC/s96l4zBP/pKJSamZMXFcIPxAV6tP+IuTL4WqvEzJChV/3NKUvEWF+DDleV X-Gm-Message-State: AOJu0Yyb9ogdUwDmp4TxfCSKk86Y0T8q13ZMxZyaIPWe0yJ6W+l8R3MI eXD5TBojCNobymMd2du83+qJaqN0Yn/NCARcR1n0OHxys4sbA2eMy1EoorYdRVE= X-Received: by 2002:a05:6000:4014:b0:360:7558:49dd with SMTP id ffacd0b85a97d-3607a75c379mr3218191f8f.36.1718386302611; Fri, 14 Jun 2024 10:31:42 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-360750ad082sm4909069f8f.59.2024.06.14.10.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 10:31:42 -0700 (PDT) Date: Fri, 14 Jun 2024 20:31:38 +0300 From: Dan Carpenter To: Yangbo Lu Cc: Richard Cochran , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH net] ptp: fix integer overflow in max_vclocks_store Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding On 32bit systems, the "4 * max" multiply can overflow. Use size_mul() to fix this. Fixes: 44c494c8e30e ("ptp: track available ptp vclocks information") Signed-off-by: Dan Carpenter --- drivers/ptp/ptp_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c index a15460aaa03b..bc1562fcd6c9 100644 --- a/drivers/ptp/ptp_sysfs.c +++ b/drivers/ptp/ptp_sysfs.c @@ -296,7 +296,7 @@ static ssize_t max_vclocks_store(struct device *dev, if (max < ptp->n_vclocks) goto out; - size = sizeof(int) * max; + size = size_mul(sizeof(int), max); vclock_index = kzalloc(size, GFP_KERNEL); if (!vclock_index) { err = -ENOMEM; -- 2.43.0