linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-acpi@vger.kernel.org, Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 2/30] ACPI-processor: Improve two size determinations in acpi_processor_get_performance_states()
Date: Sat, 10 Sep 2016 11:36:41 +0200	[thread overview]
Message-ID: <b24c70c2-7b8f-26e2-6ceb-7eab56a73a28@users.sourceforge.net> (raw)
In-Reply-To: <f9e5eb7c-54df-931c-e419-f9253e2abf20@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Sep 2016 11:11:12 +0200

Replace the specification of a data structure by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/acpi/processor_perflib.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 78f9025..004e24c 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -358,7 +358,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
 
 		struct acpi_processor_px *px = &(pr->performance->states[i]);
 
-		state.length = sizeof(struct acpi_processor_px);
+		state.length = sizeof(*px);
 		state.pointer = px;
 
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i));
@@ -400,7 +400,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
 				 * Copy this valid entry over last_invalid entry
 				 */
 				memcpy(&(pr->performance->states[last_invalid]),
-				       px, sizeof(struct acpi_processor_px));
+				       px,
+				       sizeof(*px));
 				++last_invalid;
 			}
 		}
-- 
2.10.0


  parent reply	other threads:[~2016-09-10  9:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-10  9:30 [PATCH 00/30] ACPI-processor: Fine-tuning for several function implementations SF Markus Elfring
2016-09-10  9:35 ` [PATCH 1/30] ACPI-processor: Use kmalloc_array() in acpi_processor_get_performance_states() SF Markus Elfring
2016-09-10  9:36 ` SF Markus Elfring [this message]
2016-09-10 11:47   ` [PATCH 2/30] ACPI-processor: Improve two size determinations " Borislav Petkov
2016-09-10  9:40 ` [PATCH 03/30] ACPI-processor: Rename jump labels " SF Markus Elfring
2016-09-10  9:41 ` [PATCH 04/30] ACPI-processor: Delete two unnecessary initialisations " SF Markus Elfring
2016-09-10  9:42 ` [PATCH 05/30] ACPI-processor: Rename jump labels in acpi_processor_preregister_performance() SF Markus Elfring
2016-09-10  9:44 ` [PATCH 06/30] ACPI-processor: Move a success indication " SF Markus Elfring
2016-09-10  9:45 ` [PATCH 07/30] ACPI-processor: Rename jump labels in acpi_processor_get_psd() SF Markus Elfring
2016-09-10  9:48 ` [PATCH 08/30] ACPI-processor: Delete two unnecessary initialisations " SF Markus Elfring
2016-09-10  9:50 ` [PATCH 09/30] ACPI-processor: Improve a size determination " SF Markus Elfring
2016-09-10  9:51 ` [PATCH 10/30] ACPI-processor: Rename jump labels in acpi_processor_get_performance_control() SF Markus Elfring
2016-09-10  9:52 ` [PATCH 11/30] ACPI-processor: Delete two unnecessary initialisations " SF Markus Elfring
2016-09-10  9:54 ` [PATCH 12/30] ACPI-processor: Rename jump labels in acpi_processor_ppc_notifier() SF Markus Elfring
2016-09-10  9:55 ` [PATCH 13/30] ACPI-processor: Delete an unnecessary initialisation " SF Markus Elfring
2016-09-10  9:55 ` [PATCH 00/30] ACPI-processor: Fine-tuning for several function implementations Paolo Bonzini
2016-09-10  9:56 ` [PATCH 14/30] ACPI-processor: Delete an unnecessary initialisation in acpi_processor_get_performance_info() SF Markus Elfring
2016-09-10  9:57 ` [PATCH 15/30] ACPI-processor: Delete an unnecessary initialisation in acpi_processor_get_platform_limit() SF Markus Elfring
2016-09-10  9:58 ` [PATCH 16/30] ACPI-processor: Use kmalloc_array() in acpi_processor_get_throttling_states() SF Markus Elfring
2016-09-10  9:59 ` [PATCH 17/30] ACPI-processor: Improve another size determination " SF Markus Elfring
2016-09-10 10:00 ` [PATCH 18/30] ACPI-processor: Rename jump labels " SF Markus Elfring
2016-09-10 10:01 ` [PATCH 19/30] ACPI-processor: Delete two unnecessary initialisations " SF Markus Elfring
2016-09-10 10:02 ` [PATCH 20/30] ACPI-processor: Fix jump targets in acpi_processor_get_throttling_info() SF Markus Elfring
2016-09-10 10:03 ` [PATCH 21/30] ACPI-processor: Rename jump labels in acpi_processor_get_tsd() SF Markus Elfring
2016-09-10 10:04 ` [PATCH 22/30] ACPI-processor: Delete two unnecessary initialisations " SF Markus Elfring
2016-09-10 10:05 ` [PATCH 23/30] ACPI-processor: Improve a size determination " SF Markus Elfring
2016-09-10 10:06 ` [PATCH 24/30] ACPI-processor: Rename jump labels in acpi_processor_get_throttling_control() SF Markus Elfring
2016-09-10 10:07 ` [PATCH 25/30] ACPI-processor: Delete two unnecessary initialisations " SF Markus Elfring
2016-09-10 10:08 ` [PATCH 26/30] ACPI-processor: Fix jump targets in acpi_processor_reevaluate_tstate() SF Markus Elfring
2016-09-10 10:09 ` [PATCH 27/30] ACPI-processor: Delete an unnecessary initialisation " SF Markus Elfring
2016-09-10 10:10 ` [PATCH 28/30] ACPI-processor: Rename a jump label in acpi_processor_get_platform_limit() SF Markus Elfring
2016-09-10 10:11 ` [PATCH 29/30] ACPI-processor: Delete an unnecessary initialisation " SF Markus Elfring
2016-09-10 10:12 ` [PATCH 30/30] ACPI-processor: Improve jump targets in acpi_processor_update_tsd_coord() SF Markus Elfring
2017-08-06 10:05 ` [PATCH 00/30] ACPI-processor: Fine-tuning for several function implementations SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b24c70c2-7b8f-26e2-6ceb-7eab56a73a28@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).