From nobody Sat Nov 30 03:53:09 2024 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 5811E1BAEF9 for ; Thu, 12 Sep 2024 15:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726155583; cv=none; b=joWqHXYlWkAlCRL7qfbT5w2VP9jNsbE4vFkFa9yhmO/SWm8SoJJmwFzB9+jCWNByzvzpP4NULWFEeyyCO4wv4y5/4eej7gDtjv2CN67bSwdLiVs8C9IfNMRJV1b0ViPOYGf9B4LnJFyy/Wqq6EAdZNokPYR6OSS0+pIRS3lEOfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726155583; c=relaxed/simple; bh=36Sxi+gbBpE+8wmTVMyJTVNzyvmV3WPwvvIGgTk/KzQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cNAD1zuAlp5KXkENLnqO7Uzl1SsDKDE4CGDkobe3Z6Q98+1L4GKIuBZ4E7bHbPP0U8ayqlcQlx3dqzUJEpDzr38Zm+kPK0GaCNatGkNak8wCpeZB3GCuPdwpqqlBmcgmqL9IIGlqwg8ccuBaLOHvzzDYN4eiGVevThVea9mLSvc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toblux.com; spf=none smtp.mailfrom=toblux.com; dkim=pass (2048-bit key) header.d=toblux-com.20230601.gappssmtp.com header.i=@toblux-com.20230601.gappssmtp.com header.b=KYutAf2z; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toblux.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toblux.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toblux-com.20230601.gappssmtp.com header.i=@toblux-com.20230601.gappssmtp.com header.b="KYutAf2z" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5c3c2405766so177012a12.3 for ; Thu, 12 Sep 2024 08:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toblux-com.20230601.gappssmtp.com; s=20230601; t=1726155579; x=1726760379; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=z9euUjqtbYgwWwgE1/oq9DzNoO18ZxptGpiy8C+yuEE=; b=KYutAf2z6ZdLzRKbhPktFomiuVkRknUGUH4UeVhcTvTkCE+NxdsnddJuRg7m9daqro YRZTGuNzbQwzuZQilReSOzgw9mAvQBLB2RnmuxaC4SYBlmWPiDn0wG2Kh5MkphFTUbNz xijolhFaPcF+1VzcT6T4iw0H+I/JKIYEqa2R9i5Y1y9MIXw3fWGnq5g44paPhJ1E2KoX 7rH7km5U5ik9Z8Prm6lcGjippwCKjCFCh67Xwl51WTvxxUhGX1LgAGcbu7PhICmqxcjd NBaIGgx5Tkye0zMpIw2JCbn6/oRx3SqVgFI9yhrgc2ndkSJ7c6JiEZklnYWtckYRJf9a nqKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726155579; x=1726760379; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z9euUjqtbYgwWwgE1/oq9DzNoO18ZxptGpiy8C+yuEE=; b=JWPLp2Mmlds8og43psgaPXuJ/AH6DT2FLaKFtdEgUBH91FCjLWKcmwHo7VHyySEphM J0njJt4HtQLv1zVpecb7HmnACUHHnauCeQe8Fe2FMUGwAvYJi7kOvgSt+Vi7WgaOI00l y28PZazsc5mrHks71ejg1ESwHYAT6lowc/sbhJf/LteGFnNt2hxxE/XDuwmlMT9VpPVf dg2hTLGrcKTVgWbr455jhS3VXPwF5wVpwZ72t6mmAkf3agEfxhFaUbwGGla/MS27u46a egClmeLAEI/dSuQdQtCF5XcqpBFJL/Sv08RNqufVPV+uQPZl8ZXk3RaVApzZzqXdERRv UszA== X-Forwarded-Encrypted: i=1; AJvYcCWfvLCB1TsIGX2+CWCbbEsRYJqG5ZBUbybBGAbJUU+HpR6rr8T+hrdYFxZiR6oy4OIbFnG5cgrvosgzm5E=@vger.kernel.org X-Gm-Message-State: AOJu0YzeFuo7TGPtCv0Nl9pqBBZP9sJaQ0s3AwUXgo3nsPqawdewuswV yjMKKQzfPYHq3bO3KoQwI2izsYgovgCRxjYpBGvIuw0MA8/qZUNNG8k//OkqRanQgOmQagPwCpX e X-Google-Smtp-Source: AGHT+IHCqQ88trVe2YKiL2igp8EWFO/FeGG+AEqn7eeF6kH5sk4mmdw/rmPnL7ucA079Y/QGVbLl/g== X-Received: by 2002:a05:6402:2113:b0:5c3:eb29:83ce with SMTP id 4fb4d7f45d1cf-5c413e60babmr1334577a12.9.1726155579239; Thu, 12 Sep 2024 08:39:39 -0700 (PDT) Received: from fedora.fritz.box (aftr-62-216-208-212.dynamic.mnet-online.de. [62.216.208.212]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd52135sm6694734a12.49.2024.09.12.08.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 08:39:38 -0700 (PDT) From: Thorsten Blum To: xiubli@redhat.com, idryomov@gmail.com Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Thorsten Blum Subject: [PATCH] ceph: Use struct_size() helper Date: Thu, 12 Sep 2024 17:39:24 +0200 Message-ID: <20240912153924.78724-1-thorsten.blum@toblux.com> X-Mailer: git-send-email 2.46.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use struct_size() to calculate the number of bytes to be allocated. Signed-off-by: Thorsten Blum --- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index c4744a02db75..ab494f250d80 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -2133,7 +2133,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_inf= o *ci, } =20 pool_ns_len =3D pool_ns ? pool_ns->len : 0; - perm =3D kmalloc(sizeof(*perm) + pool_ns_len + 1, GFP_NOFS); + perm =3D kmalloc(struct_size(perm, pool_ns, pool_ns_len + 1), GFP_NOFS); if (!perm) { err =3D -ENOMEM; goto out_unlock; --=20 2.46.0