From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 609E8C4332F for ; Mon, 30 Oct 2023 14:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=f5BVxHiVP0hmeivtTsNtVqhs2I+OZ5Vfghtnwa0rWfo=; b=RnhJSXNf0rXadE +l+F5De/wTgIkKW/derMEMe53wW7zvfe2CV62yNj77a+Vp1pj8emSSWkgYYByZukIP5Pzx3JVyvqO ICOwQwLseqR4ITyGLQEA3wadEdEZAFg0L6DQjT3d7UvyuyLCPmtHad5v3Ff4BPybqjUFKOEAuGeUR tap0tDvCaa70Us7wODcEFKbxUxKxL9wGkDch09x/NHuVeZslflz4sC/9gFgHLTXPazGoIDcThw7FA rm8uSY3CBe7PmfM9v6kIElFl47OAvr3S6epJfytR6mgtAN9EIzH2n8s0ILnfLi93v3zX3omnmt33r Ki/7mxsVN3sYQ9xXb8nA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxTIP-003ULn-2g; Mon, 30 Oct 2023 14:31:13 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxTIN-003ULN-0b for linux-arm-kernel@lists.infradead.org; Mon, 30 Oct 2023 14:31:12 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4084b0223ccso35560545e9.2 for ; Mon, 30 Oct 2023 07:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698676269; x=1699281069; darn=lists.infradead.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=zolf4+AjHo6TOV47CAZe/w4/P0gSz3+kZ+O7ZhHXrCs=; b=It3jeAwAHI7HQJW1ehjx8DTl3izqs6W6/7f89yM1zQDawcXqFy/tNztkxYsx4CsDmD T46FQxrDjB4ggMmzO+obGw07hZfsrx1Zyo+KO1/tjCudd438QDrlMBvAemZIl9DldwAL lULLZD2WsmoVS3C13Kkt18qAYr3ePL5YCVumkb0f51TwqxQIKm1n1a+9ZptIRKNXhrjE IgKLVEHnV84cKB6BBbURMFQ1EH7y0rCpsu0EoPC0umVdZQtR8XwCz97j2reo0uqLSfzl mmrgfLKwlXu0zeWzcnhvrnQkwQtGuf9UCTX0E8xloOej+h12uocESrLcNtgnn8ExR3fc 0eyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698676269; x=1699281069; 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=zolf4+AjHo6TOV47CAZe/w4/P0gSz3+kZ+O7ZhHXrCs=; b=JmyrwamryKjt/WGo5LIbf6/Mep/iT5IsHNkE7ifNVso3Br2RXe+xMCWh9zrUKF9mMU uNzJ7qqD/PoA+Kb7yCtrotuI+g5RPmZnAURhLQ19F2VJnnF5Z73mfscJNQmPr1YNGg9J 4tXnkRHmYcFVse78TX/nUOxfZJejwPPehNo7n17rlW6G+rKHQkEkrMf3Y6FMz/u9u7wI LRJz6ARoqDyUilqxq1D27gc8HoWj7I3wuTSHgEToNQLXxKgWcMP39RZ7P+3oWuYCoYQS p3Tff0V9zhTMEPZLYDPMlK28KshEQtSajUx5LJtQBwIoAHCLk6kiyEuLdT7ESxx1C1Wt sN5A== X-Gm-Message-State: AOJu0Ywxp1MBswMV2QooZ2UsCxTOSukyBMSj+C9zVUAi8h3wYyCe1V7/ Qcr12u5ttnKz6Oi8B8E0/XuEvQ== X-Google-Smtp-Source: AGHT+IGOaLPDuVL7Jtjj9mD6LyTvt0us7JESeR0+5cUgPdE5TtSFAeae2IRjHhbL2NZQT+QWuxP9Vw== X-Received: by 2002:a05:600c:1f87:b0:406:411f:742e with SMTP id je7-20020a05600c1f8700b00406411f742emr8195721wmb.34.1698676269359; Mon, 30 Oct 2023 07:31:09 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id w7-20020a5d6807000000b0032008f99216sm8288846wru.96.2023.10.30.07.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 07:31:08 -0700 (PDT) Date: Mon, 30 Oct 2023 17:31:04 +0300 From: Dan Carpenter To: sudeep.holla@arm.com Cc: linux-arm-kernel@lists.infradead.org Subject: [bug report] firmware: arm_ffa: Add schedule receiver callback mechanism Message-ID: <0e8ddbca-d9da-4a3b-aae3-328993b62ba2@moroto.mountain> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231030_073111_228901_11825A2F X-CRM114-Status: UNSURE ( 8.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Sudeep Holla, The patch 0184450b8b1e: "firmware: arm_ffa: Add schedule receiver callback mechanism" from Oct 5, 2023 (linux-next), leads to the following Smatch static checker warning: drivers/firmware/arm_ffa/driver.c:1251 ffa_partitions_cleanup() warn: double check that we're allocating correct size: 8 vs 88 drivers/firmware/arm_ffa/driver.c 1243 static void ffa_partitions_cleanup(void) 1244 { 1245 struct ffa_dev_part_info **info; 1246 int idx, count = drv_info->partition_count; 1247 1248 if (!count) 1249 return; 1250 --> 1251 info = kcalloc(count, sizeof(**info), GFP_KERNEL); I *think* this should be sizeof(*info). It ends up being a smaller allocation (8 bytes instead of 88). 1252 if (!info) 1253 return; 1254 1255 xa_extract(&drv_info->partition_info, (void **)info, 0, VM_ID_MASK, We copy count pointers to info. We don't copy entire structs. It still works but it's larger than necessary. 1256 count, XA_PRESENT); 1257 1258 for (idx = 0; idx < count; idx++) 1259 kfree(info[idx]); 1260 kfree(info); 1261 1262 drv_info->partition_count = 0; 1263 xa_destroy(&drv_info->partition_info); 1264 } regards, dan carpenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel