>From 0176a7981aead1a202d5d0295b074e165b0d39dd Mon Sep 17 00:00:00 2001 From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> Date: Thu, 3 Sep 2020 21:27:55 +0200 Subject: [PATCH 05/34] open_by_handle_at.2: Use sizeof consistently Use ``sizeof`` consistently through all the examples in the following way: - Use the name of the variable instead of its type as argument for ``sizeof``. Rationale: https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> --- man2/open_by_handle_at.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man2/open_by_handle_at.2 b/man2/open_by_handle_at.2 index 78c3220f8..846957acf 100644 --- a/man2/open_by_handle_at.2 +++ b/man2/open_by_handle_at.2 @@ -586,7 +586,7 @@ main(int argc, char *argv[]) /* Reallocate file_handle structure with correct size */ - fhsize = sizeof(struct file_handle) + fhp\->handle_bytes; + fhsize = sizeof(*fhp) + fhp\->handle_bytes; fhp = realloc(fhp, fhsize); /* Copies fhp\->handle_bytes */ if (fhp == NULL) errExit("realloc"); @@ -707,7 +707,7 @@ main(int argc, char *argv[]) /* Given handle_bytes, we can now allocate file_handle structure */ - fhp = malloc(sizeof(struct file_handle) + handle_bytes); + fhp = malloc(sizeof(*fhp) + handle_bytes); if (fhp == NULL) errExit("malloc"); -- 2.28.0