From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t v2 2/4] assembler: fix calloc calls with inverted arguments
Date: Wed, 10 Apr 2024 16:42:36 +0200 [thread overview]
Message-ID: <20240410144321.44766-3-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20240410144321.44766-1-mauro.chehab@linux.intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
The new gcc version 14 now complains when calloc is called
with inverted arguments. use the script from:
a0ee73a8f359 ("benchmarks: fix calloc calls with inverted arguments")
To fix it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
assembler/gram.y | 6 +++---
assembler/main.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/assembler/gram.y b/assembler/gram.y
index 77975e072896..79873b222253 100644
--- a/assembler/gram.y
+++ b/assembler/gram.y
@@ -216,7 +216,7 @@ brw_program_add_instruction(struct brw_program *p,
{
struct brw_program_instruction *list_entry;
- list_entry = calloc(sizeof(struct brw_program_instruction), 1);
+ list_entry = calloc(1, sizeof(struct brw_program_instruction));
list_entry->type = GEN4ASM_INSTRUCTION_GEN;
list_entry->insn.gen = instruction->insn.gen;
brw_program_append_entry(p, list_entry);
@@ -228,7 +228,7 @@ brw_program_add_relocatable(struct brw_program *p,
{
struct brw_program_instruction *list_entry;
- list_entry = calloc(sizeof(struct brw_program_instruction), 1);
+ list_entry = calloc(1, sizeof(struct brw_program_instruction));
list_entry->type = GEN4ASM_INSTRUCTION_GEN_RELOCATABLE;
list_entry->insn.gen = instruction->insn.gen;
list_entry->reloc = instruction->reloc;
@@ -239,7 +239,7 @@ static void brw_program_add_label(struct brw_program *p, const char *label)
{
struct brw_program_instruction *list_entry;
- list_entry = calloc(sizeof(struct brw_program_instruction), 1);
+ list_entry = calloc(1, sizeof(struct brw_program_instruction));
list_entry->type = GEN4ASM_INSTRUCTION_LABEL;
list_entry->insn.label.name = strdup(label);
brw_program_append_entry(p, list_entry);
diff --git a/assembler/main.c b/assembler/main.c
index 2d39d4536a7f..77cc98b80d21 100644
--- a/assembler/main.c
+++ b/assembler/main.c
@@ -397,7 +397,7 @@ int main(int argc, char **argv)
if (entry1 && is_label(entry1) && is_entry_point(entry1)) {
// insert NOP instructions until (inst_offset+1) % 4 == 0
while (((inst_offset+1) % 4) != 0) {
- tmp_entry = calloc(sizeof(*tmp_entry), 1);
+ tmp_entry = calloc(1, sizeof(*tmp_entry));
tmp_entry->insn.gen.header.opcode = BRW_OPCODE_NOP;
entry->next = tmp_entry;
tmp_entry->next = entry1;
--
2.44.0
next prev parent reply other threads:[~2024-04-10 14:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 14:42 [PATCH i-g-t v2 0/4] Fix warnings with gcc 14 Mauro Carvalho Chehab
2024-04-10 14:42 ` [PATCH i-g-t v2 1/4] benchmarks: fix calloc calls with inverted arguments Mauro Carvalho Chehab
2024-04-10 15:06 ` Kamil Konieczny
2024-04-10 14:42 ` Mauro Carvalho Chehab [this message]
2024-04-10 15:13 ` [PATCH i-g-t v2 2/4] assembler: " Kamil Konieczny
2024-04-10 14:42 ` [PATCH i-g-t v2 3/4] tests: " Mauro Carvalho Chehab
2024-04-10 15:15 ` Kamil Konieczny
2024-04-10 14:42 ` [PATCH i-g-t v2 4/4] lib: " Mauro Carvalho Chehab
2024-04-10 15:17 ` Kamil Konieczny
2024-04-10 23:30 ` ✗ Fi.CI.BAT: failure for Fix warnings with gcc 14 Patchwork
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=20240410144321.44766-3-mauro.chehab@linux.intel.com \
--to=mauro.chehab@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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