lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 20 Jan 2019 11:06:18 +0000 From: Eran Ben Elisha <eranbe@...lanox.com> To: Jiri Pirko <jiri@...nulli.us> CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, Jiri Pirko <jiri@...lanox.com>, "David S. Miller" <davem@...emloft.net>, Ariel Almog <ariela@...lanox.com>, Aya Levin <ayal@...lanox.com>, Moshe Shemesh <moshe@...lanox.com> Subject: Re: [PATCH net-next v2 01/11] devlink: Add health buffer support On 1/20/2019 12:03 PM, Jiri Pirko wrote: > Thu, Jan 17, 2019 at 10:59:10PM CET, eranbe@...lanox.com wrote: > > [...] > >> +static void >> +devlink_health_buffers_destroy(struct devlink_health_buffer **buffers_list, >> + u64 size); > > Avoid fwd declarations. > > >> + >> +static struct devlink_health_buffer ** >> +devlink_health_buffers_create(u64 size) >> +{ >> + struct devlink_health_buffer **buffers_list; >> + u64 num_of_buffers = DEVLINK_HEALTH_SIZE_TO_BUFFERS(size); >> + u64 i; >> + >> + buffers_list = kcalloc(num_of_buffers, >> + sizeof(struct devlink_health_buffer *), >> + GFP_KERNEL); >> + if (!buffers_list) >> + return NULL; >> + >> + for (i = 0; i < num_of_buffers; i++) { >> + struct devlink_health_buffer *buffer; >> + void *data; >> + >> + buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); >> + data = kzalloc(DEVLINK_HEALTH_BUFFER_SIZE, GFP_KERNEL); >> + if (!buffer || !data) { >> + kfree(buffer); >> + kfree(data); >> + goto buffers_cleanup; >> + } >> + buffers_list[i] = buffer; >> + buffer->data = data; >> + } >> + devlink_health_buffers_reset(buffers_list, num_of_buffers); >> + >> + return buffers_list; >> + >> +buffers_cleanup: >> + devlink_health_buffers_destroy(buffers_list, --i); > > Just do for-kfree here. > > >> + kfree(buffers_list); >> + return NULL; >> +} >> + >> +static void >> +devlink_health_buffers_destroy(struct devlink_health_buffer **buffers_list, >> + u64 num_of_buffers) >> +{ >> + u64 i; >> + >> + for (i = 0; i < num_of_buffers; i++) { >> + kfree(buffers_list[i]->data); >> + kfree(buffers_list[i]); >> + } >> +} >> + > > [...] > Hi Jiri, The series is merged. I can take the relevant comments as send as fix with the rest of the series if you wish to. Eran
Powered by blists - more mailing lists