Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: Fix calloc arguments that are in the wrong order #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ acpi_get_irdt_chms(struct acpi_table_irdt_device *dev,
size_t chms_len = dev->length - dss_size;

*num = chms_len / sizeof(struct acpi_table_irdt_chms);
*chms = calloc(sizeof(struct acpi_table_irdt_chms *), *num);
*chms = calloc(*num, sizeof(struct acpi_table_irdt_chms *));
if (!*chms) {
LOG_ERROR("Memory allocation failed!\n");
*num = 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/iordt.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,13 @@ iordt_init(const struct pqos_cap *cap, struct pqos_devinfo **devinfo)

acpi_print(table);

m_devinfo = (struct pqos_devinfo *)calloc(sizeof(*m_devinfo), 1);
m_devinfo = (struct pqos_devinfo *)calloc(1, sizeof(*m_devinfo));
if (m_devinfo == NULL) {
acpi_free(table);
return PQOS_RETVAL_ERROR;
}

m_mmioinfo = (struct iordt_mmioinfo *)calloc(sizeof(*m_mmioinfo), 1);
m_mmioinfo = (struct iordt_mmioinfo *)calloc(1, sizeof(*m_mmioinfo));
if (m_mmioinfo == NULL) {
acpi_free(table);
free(m_devinfo);
Expand Down
Loading