Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp116385lqb; Thu, 14 Mar 2024 07:01:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWwCzhFH2BC/761WP/Bef9zxA3sHphcuE15VOO9z1pjUN8ayBQPlnxbxX8cfwGL5mBoMiF356dALmk99vpr7uJ0rUS8EA5Rr+Gj1jzKA== X-Google-Smtp-Source: AGHT+IHM2G3KHHKiCoEno1jABZjxUtsvhAmqZWGMHMaaUjlcWhgyEfhqeU/3ifvn81l4LNqF/8Fg X-Received: by 2002:a17:90b:1051:b0:29c:7536:bdec with SMTP id gq17-20020a17090b105100b0029c7536bdecmr2001473pjb.34.1710424884667; Thu, 14 Mar 2024 07:01:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710424884; cv=pass; d=google.com; s=arc-20160816; b=IWpSmbSXc7R4Gyxmmcxo28yM5ZRbubP0pv4O/zBgZudjgVtaofgZ1jc3ObarnB2+/e 1oE7BdCB9wGKFYL1WP2BelQppb10lVGwjS6ONjtemaBhD+oa2m9R0QsP9yR1/+GyMr1b cRaL9fAhgn8AU9+o8WtTc9KFbGre55FZ4WFbIVU2VtZEf19f7V+sHRIW5nSiKa8OsZHw 9zhYJa0ReTIxfNLZyWB+koWP3UdgbhkKZIBp76lUH5VO1hIRPp2Kj3+ABH8UwkYpZHGy Fga1oy6zDW/CfPYsRewMWnLXcxLDXJPfBEmW8f/by7juPpTb25AmkP1rI1W3+UVqeu2N BFKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=YZ3rbrGjha02UD0mhfO3FCamNF+pYQ8Ho++Y52tVh1E=; fh=wp+gE3uw7M3PszCqce+XQYJP/3asje6MoLbVo8Vzt9k=; b=tv+djCaYYU3PRLilwsmcBJ3EqiDK4yBOAHpuWcE4Nqa0zS2eQPIJSJ1BqmkiLMnkQl rjWtYkYkPIqGAwPYAlOS4aWR7DENyhveKDT3YUdiz6bUpSmj9YSB5kEcWcOmUQikaldv kf4u7UzwptX6w6wEavln8PJptTeQRudhrBzhACwonS7AoxepCgRy1GbyzBGInF8PBjc/ Q3RkfbWMzix97EwU2wvyRYyJo+tJYpqXB8tx0om+sWJ4watTeqK3OhQKMCnh7MRR8L+9 ktz9FriPNJe6Aaj+NkAE3//s00J3mcCklxt8TV3yFTpd6OzUfJ1pxOS3ERW3a1/B53W2 cZ8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lexina.in header.s=dkim header.b=Md0swrBj; arc=pass (i=1 spf=pass spfdomain=lexina.in dkim=pass dkdomain=lexina.in dmarc=pass fromdomain=lexina.in); spf=pass (google.com: domain of linux-kernel+bounces-103334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=lexina.in Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id gx7-20020a17090b124700b0029dd8953b07si678315pjb.144.2024.03.14.07.01.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 07:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lexina.in header.s=dkim header.b=Md0swrBj; arc=pass (i=1 spf=pass spfdomain=lexina.in dkim=pass dkdomain=lexina.in dmarc=pass fromdomain=lexina.in); spf=pass (google.com: domain of linux-kernel+bounces-103334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=lexina.in 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 A6680B20C31 for ; Thu, 14 Mar 2024 13:59:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F26956EB79; Thu, 14 Mar 2024 13:59:43 +0000 (UTC) Received: from mx.msync.work (mx.msync.work [62.182.159.68]) (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 BC4715B696 for ; Thu, 14 Mar 2024 13:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.182.159.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710424777; cv=none; b=uji8d7ngq9G3iS7Iw1S13OA8mp4YFsRiILLcqpodmvMUFfIGdHTtIjOY2s9zwkXN6dsHpVjVwii6CU+gkNppIolGXXP/d/zlLol57FJne5BVCU2VL0Pks4HfIei+f8cBcVtcxGLXnDZI/zx1M7/BrdrcFoJhEUTzRHVHRjJdfvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710424777; c=relaxed/simple; bh=nyFk1wBCVZIwINNr7Q2CQAh4CqvsfLS/MznOXQaQ+cQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kn1lejJr0nH/wJIVzaQcdEz9+nosyM+/G7/tFyiEdGyD3gY1c6QIJU0SsTmwW8BwuuelcuLYZ5uJZcqhngIE5KU9Okd4qxHX/f7jtoiQGyNSTlMBFvcb9QkDSZXu3EWKkjJgCIk1joHtR/tZXBopG2xtuwTysUiQhe8y2tT5bnc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=lexina.in; spf=pass smtp.mailfrom=lexina.in; dkim=pass (2048-bit key) header.d=lexina.in header.i=@lexina.in header.b=Md0swrBj; arc=none smtp.client-ip=62.182.159.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=lexina.in Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lexina.in Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4300111FF8E; Thu, 14 Mar 2024 13:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1710424751; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references:autocrypt; bh=YZ3rbrGjha02UD0mhfO3FCamNF+pYQ8Ho++Y52tVh1E=; b=Md0swrBj3xps/eY4kwEchUDXfJz0FpK7fkri6MsvOE4gzA2MZ6ygs727fv3U4+fFHFf7Mc abV1L2yzhxDdwhYV+g3+ca+usHS+dRCig5RNwkaFwtjoJLQqa0W+bTST3Kk3endYVoGP0n S4kLFfQFm1Yty4SfCax4Dj6UhkJJCtlCyc/YGftn/b5U8IUt4S0Ku6xgmn6reigZgQu3um SF7LEGYVa3EA3fdgvSH3d2+Qvg5l1wTnT0S3KUQ6gCkO2+VYTJ4drKr9RKjtgab8GkJJ7S VOTDwxs+ImxmgS6R2sR+53v01oGq0mguMRk63aIVoJB2wVeXdhQ7YC+Ct3ImfA== Message-ID: Date: Thu, 14 Mar 2024 16:59:09 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/4] soc: amlogic: meson-gx-socinfo-sm: Add Amlogic secure-monitor SoC Information driver To: Krzysztof Kozlowski , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski References: <20240314070433.4151931-1-adeep@lexina.in> <20240314070433.4151931-3-adeep@lexina.in> <111346d3-8357-4ca3-9249-a43ebc225fcb@linaro.org> <9292d2ee-138a-4a59-9c96-31c1b4473a4e@lexina.in> Content-Language: en-US, ru-RU From: Viacheslav Autocrypt: addr=adeep@lexina.in; keydata= xsDNBF+1fsQBDADh4przgt1LU4l+B6rIWel42Mg3hgdgbZ2nlIkKnaaNLXkm5rK0EJJeStd7 8sxsdk9n7UQFB3mkmgjc89zyAG+CDG/+KZQMWOsc5IvWlDebKlefieyvf9yvV4qcQTeudr3C CgUxq8qsp1fDX9jdSjz5/OMJKrxCElMxLxJTFF+FHtWvUIMr4txesE8NP7f7VnIYILEeMM8q gvptNUrWQr6KTv4XnRD/BvsRZJWnQ/a5MzMGQWzw7LeT4vhV4lYqJsXmxbGLUOKi+5ZpslR3 Ffby2kdL1Xyq6Y7Gi70RhUpKP0xGJ6gDVs6SjFSb9UxgrjwNBWZcFeSJkc6pR5JbgbYMRvdA W5CNnA8TzdfhPgO3HEDFlsVqberSBI/tMiwHWPze7jkv7ttx/Wg9+RZybFfCkGm4XvKh7aP4 jG3Td43mqhyHGzOd/EUxNITebqxqpEJTmRCisgpjr3M76aht4UFz11tP/QEuCrpDX0bOMPYA 4aohmhw5FLyWUPg0JllH6kEAEQEAAc0SIDxhZGVlcEBsZXhpbmEuaW4+wsDwBBMBCgAaBAsJ CAcCFQoCFgECGQEFgl+1fsQCngECmwMACgkQ7jaxEAJajfrgvAwA051C6jUKS6Wp4oy2Or0i B1HXCDDaCS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e+5LnTegejiCaGbxklGFIWkGamX/DOm3QF+ZaKsoXUf/kmpL10dnsExiGHTeGw 7zR8+rOkVnK6fq0ady43a7RxKP5nW0pDVclTvsAWr1CcdFrCVpH2idj7fjtAmZlMbuiEMXoo kaDXdhJtS60VrwS4xUlw4ZPQjMZdQdvpu4vGtZUfJr+8vJ757d9N3EGpFUrk+5QWozjktLVm gdQ0nlD9ji3RpwjhQWCIoi6GmdWpfdj3LzDO/DwWRLlz8iAdZG3pHSGsCmM2MJ16HbPnsSxr YrKwM/HVpqTSVsprnQogPL/xM0AH11uAbqNvIvm6sUkEmx2kdBzTKjY0YdSkpUgTauWn13bg Ay+0xfqxRvYBSsHpWpnSnsI12861OVGnYsnB8gJlJLSQjOl3Kwq36MeWbAg6Bs4PnNU4i+uO rz9PJ4vHmMYfmMDJLYWJI6pcLyAoZSE/bSTLaRV73/zjtlX85mtEL3fvh6G342uRCvAwqgI= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 14/03/2024 16.31, Krzysztof Kozlowski wrote: > On 14/03/2024 13:22, Viacheslav wrote: >>> + >>>> + soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), >>>> + GFP_KERNEL); >>>> + if (!soc_dev_attr) >>>> + return -ENOMEM; >>>> + >>>> + soc_dev_attr->serial_number = socinfo_get_chipid(&pdev->dev, fw, &socinfo); >>>> + >>>> + soc_dev_attr->family = "Amlogic Meson"; >>>> + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", >>>> + socinfo.v1.major_id, >>>> + socinfo.v1.chip_rev, >>>> + socinfo.v1.pack_id, >>>> + (socinfo.v1.reserved<<4) + socinfo.v1.layout_ver); >>>> + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", >>>> + socinfo_v1_to_soc_id(socinfo), >>>> + socinfo_v1_to_package_id(socinfo)); >>>> + >>>> + soc_dev = soc_device_register(soc_dev_attr); >>>> + >>>> + >>>> + if (IS_ERR(soc_dev)) { >>>> + kfree(soc_dev_attr->revision); >>>> + kfree_const(soc_dev_attr->soc_id); >>>> + kfree(soc_dev_attr); >>> >>> That's a double free. This was not tested. >> >> >> Please, describe the problem. > > Test your code. What's the point of arguing over it if regular test > would show this? > >> I don't quite understand what the issue is: >> >> - kfree() releases memory allocated with kmalloc() > > So point me where is kmalloc(). I don't see. I see only devm. I missed the point that devm_kzalloc is automatically freed. You are right. Thanks! -- Best regards Viacheslav