> This is manifestly wrong: it would leak memory as it circulates around
> the loop.

I don't think the memory leak happens.
As you can see below, if  a new entry is not created, kfree() is called outside 
while(1).

static void efivar_update_sysfs_entries(struct work_struct *work)
{
        struct efivar_entry *entry;
        int err;

        /* Add new sysfs entries */
        while (1) {
                entry = kzalloc(sizeof(*entry), GFP_KERNEL);
                if (!entry)
                        return;

                memset(entry, 0, sizeof(*entry));

                err = efivar_init(efivar_update_sysfs_entry, entry,
                                  true, false, &efivar_sysfs_list);
                if (!err)
                        break;

                efivar_create_sysfs_entry(entry);
        }

        kfree(entry);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to