Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1442125lqa; Mon, 29 Apr 2024 08:33:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxHF/uSeXhDREL8m/+dUts/oxpDMNizrLD1skHxTfvHqfvCkhKQ4DmODluc+TrxlJs4K8xlGTYZjj38P7GXNDKuE4PpfWpm5hP7/YbnQ== X-Google-Smtp-Source: AGHT+IEPIY8M5JJ/1MWhN9HM2y8QO2e80q07MI7U7IxaLiFMljXsHmKPhBV0ExBWFZc2lBefWaGm X-Received: by 2002:a05:6a00:b4f:b0:6ed:cd4c:cc1a with SMTP id p15-20020a056a000b4f00b006edcd4ccc1amr14068120pfo.8.1714404785146; Mon, 29 Apr 2024 08:33:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714404785; cv=pass; d=google.com; s=arc-20160816; b=b+Pbw0EuV8v4hwu27PsmvHnC5gkt1erqfM7WFYa+ti2vt6oIEBg5ycTPHhWMMewrgw fU/zQ8YPVnGeSTOJ5kbWI5FcIiVdNl8E+GUzYxpyhoKzKQ9PRxcJ7CFATQ5ZyGjiiasd RrrEupJl2ARgsE6J8aK/5JFi5jdc+pqJZAxFqCiin6IPT/LZcNuBTA4wJoSHVsg7fm0R 38vRpA/Fi9yXjId3EOs1eR/g+bl1jgxZsFFBYGe3zhrnHPHSMIw5dVkNqYTWXlX+ghZg 5vuunGLAgl0mHwafPJolt0QsmULhzumTIfjW/i4dQrAcQNtuXsRxlOMOOmFOVyocvLt7 L2Lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=Whc+kehZFOrnNVxoQ+aJ0hCobdq4Ed5IJwv8Dg8dkaE=; fh=MbAOTjIS9V0C3s8/KBfQikjxLAzY0ve4Ldl5UZKoOJU=; b=eyhwYkg5tAeTLA/1j0M+remQIDAtmMidhIXlsLLfIjEcmBEGHXTYTeN4x7B3vZCXl2 xewAuueKqEuS+EVFXl20gfNCFdV2AVK5tAHPzXG7sry2k1x4yukUda2mBP8HctbhTbnK o07LpebMj5zx9tjrRUpMfzXAmrasbe27/BqZ5cTB9MgXCyEL/wepVpovQPGFtFEzHnIP Qm5Fpm1ONXS5WXqTB5yy4wVYu7zSOY4EZik6WfOz2T1blOhJsKmVw55gbzZ2Tx6TOdwy eNgAK/nQUG3O7hg9eeOjqE0MzXHkGayrT35V5fbZPSetMuVU0mAOxAYwBxpBJKLC0Fa0 UqSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bBz5yI39; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-162566-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162566-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u11-20020a63234b000000b005dc6cbf8440si20081602pgm.99.2024.04.29.08.33.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:33:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162566-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bBz5yI39; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-162566-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162566-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 740BA282F3E for ; Mon, 29 Apr 2024 15:23:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E46BA8664B; Mon, 29 Apr 2024 15:20:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bBz5yI39" Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 C37CB81745 for ; Mon, 29 Apr 2024 15:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714404022; cv=none; b=cAMkfHm/e74YD4+sihuTFLDNnddU+GZuDl1FWTYY3PedHx3u7MO7CSaLQltO20+FDuPHP+X7wP7jsmUjmYb5q2RXV/wy1MnJkrOH0pRoTT6qLVbGdwU1Orw3fGzTmgcP+9DTlbXjeOWwCYE8Pj9plEv2x6ginQxrnl0GcyIMwmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714404022; c=relaxed/simple; bh=w5oGRP4JPpb4te+A558b3tkZ+H0uAyOnUSQkFgcHJek=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=YMcBG65mQnXdg3kzZ+jk6opd01aaszbk7okDxvSkdI0qxe9766fDYMBWchYQFQjRGs65+Jxv9Y90BuSUJg7pUOQDAfLTzWvhCp12pHklQ7coI4ZEwlrRtzmqWF8aXhSV0SHD1VuHjIjJJN/5h7OCjo5qWUAQXmtGKVymNtEBffM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=bBz5yI39; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-790f91b834cso73479985a.0 for ; Mon, 29 Apr 2024 08:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714404019; x=1715008819; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=Whc+kehZFOrnNVxoQ+aJ0hCobdq4Ed5IJwv8Dg8dkaE=; b=bBz5yI39HX4qu5MrsmmWmYqeYLbM56I2IgDAkPYyh9Mc/FdlQ5ua3RI9EostKLOzKH DeOQqvPyX3HoUAwLUbaA/nkll/dOjxE+bvyt5LvBGsntsZIBk37eICBzb+23SEQDsSVm hh8suDjARnvQBVtX1vYbj6HKjzgTAVMT+fTiw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714404019; x=1715008819; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Whc+kehZFOrnNVxoQ+aJ0hCobdq4Ed5IJwv8Dg8dkaE=; b=otimjVZXmsgBQ1pf3wuNx3tpFi/GOIzIl2EaG38eFDxWKmfZ8dU6sME5bR43nzkYe/ 3uoQyrniGH/HJkLi3fZJO56/XmcbDq4YVOcF18dyQjfU7ajU068+RQ6ibAbQ7x250jEB 1PCtN+Y69X1+Hhncg7it8iY9FqhsuF7yxBBRJF24B/i5M/A5Yp9AXV9sUZ9be70U/VI7 tqkf7I6IvA9dN7EKHbs9Zz8F7PVVVFeDB1AnM6Nswo+3M9mP+iwF9FfcIuDsBUZ/z2Zj zVVh1uD9IBDowFUiPwH3MoCwN249DnhvMjLjv/kP4GQpCm0ShplM/QfPOyXfXyuSSzI8 bMjw== X-Forwarded-Encrypted: i=1; AJvYcCWwoU1cBrLdAYCVrf/dLiM9A+HiMIEMF9izZrIz1a7/anZEgM64kTrqSuQyrvCiXSgBLmgodofHFaO5aXMnD31U1RlATnejJbfKUOdO X-Gm-Message-State: AOJu0Yyc4TPL1klbWWc5mbt1WJWR5sD+hXH4x9Bf+f6QMsjfqssggdIa IFvSLE6Sls4MNkKKlNMaLGeiocg3u93fIH6Hk+Jzuo/VJcWuu4zUYzAH4VyuLA== X-Received: by 2002:a05:6214:2a8f:b0:6a0:b905:97b1 with SMTP id jr15-20020a0562142a8f00b006a0b90597b1mr7524418qvb.51.1714404018764; Mon, 29 Apr 2024 08:20:18 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id r3-20020a0cf603000000b006a0affc7c6esm3020797qvm.63.2024.04.29.08.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:20:18 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:20:18 +0000 Subject: [PATCH] media: dw2102: Fix size check 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="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240429-dw2102-v1-1-a5d81dfc1453@chromium.org> X-B4-Tracking: v=1; b=H4sIALG6L2YC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDEyNL3ZRyI0MDI93UFOMUQyOLRENTCyMloOKCotS0zAqwQdGxtbUAmJ8 APVgAAAA= To: Mauro Carvalho Chehab Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 The data is going to be copied at state->data[4], not at state->data[1], fix the check to avoid stack overruns. Found with smatch: drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error: __builtin_memcpy() '&state->data[4]' too small (64 vs 67) drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error: __builtin_memcpy() '&state->data[4]' too small (64 vs 67) Cc: Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write") Signed-off-by: Ricardo Ribalda --- This time it could be relevant though. --- drivers/media/usb/dvb-usb/dw2102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 03b411ad64bb..79e2ccf974c9 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -789,7 +789,7 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], if (msg[j].flags & I2C_M_RD) { /* single read */ - if (1 + msg[j].len > sizeof(state->data)) { + if (4 + msg[j].len > sizeof(state->data)) { warn("i2c rd: len=%d is too big!\n", msg[j].len); num = -EOPNOTSUPP; break; --- base-commit: cefc10d0d9164eb2f62e789b69dc658dc851eb58 change-id: 20240429-dw2102-ed3d128a1582 Best regards, -- Ricardo Ribalda