Re: [PATCH v4 16/18] x86/intel_rdt: Add schemata file

From: Thomas Gleixner
Date: Mon Oct 17 2016 - 18:38:12 EST


On Fri, 14 Oct 2016, Fenghua Yu wrote:
> +static void update_domains(struct rdt_resource *r, int closid)
> +{
> + int cpu, idx = 0;
> + struct list_head *l;
> + struct rdt_domain *d;
> + struct msr_param msr_param;
> + struct cpumask cpu_mask;

Again. No cpumasks on stack.

> +ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
> + char *buf, size_t nbytes, loff_t off)
> +{
> + char *tok, *resname;
> + struct rdtgroup *rdtgrp;
> + struct rdt_resource *r;
> + int closid, ret = 0;
> + u32 *l3_cbms = NULL;
> +
> + /* Legal input requires a trailing newline */

s/Legal/Valid/ please. There is no law which enforces this.

> + if (nbytes == 0 || buf[nbytes - 1] != '\n')
> + return -EINVAL;
> + buf[nbytes - 1] = '\0';
> +
> + rdtgrp = rdtgroup_kn_lock_live(of->kn);
> + if (!rdtgrp) {
> + rdtgroup_kn_unlock(of->kn);
> + return -ENOENT;
> + }
> +
> + closid = rdtgrp->closid;
> +
> + /* get scratch space to save all the masks while we validate input */
> + for_each_rdt_resource(r) {
> + r->tmp_cbms = kcalloc(r->num_domains << r->cdp_enabled,
> + sizeof(*l3_cbms), GFP_KERNEL);
> + if (!r->tmp_cbms) {
> + ret = -ENOMEM;
> + goto fail;
> + }
> + r->num_cbms = 0;

This wants to be r->num_tmp_cbms for clarity.

Thanks,

tglx