+ jbd-avoid-kfree-null.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     jbd: avoid kfree(NULL)

has been added to the -mm tree.  Its filename is

     jbd-avoid-kfree-null.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Andrew Morton <akpm@xxxxxxxx>

There are a couple of places where JBD has to check to see whether an unneeded
memory allocation was performed.  Usually it _was_ needed, so we end up
calling kfree(NULL).  We can micro-optimise that by checking the pointer
before calling kfree().

Thanks to Steven Rostedt <rostedt@xxxxxxxxxxx> for identifying this.

Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/jbd/transaction.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff -puN fs/jbd/transaction.c~jbd-avoid-kfree-null fs/jbd/transaction.c
--- devel/fs/jbd/transaction.c~jbd-avoid-kfree-null	2006-04-23 14:03:00.000000000 -0700
+++ devel-akpm/fs/jbd/transaction.c	2006-04-23 14:04:26.000000000 -0700
@@ -227,7 +227,8 @@ repeat_locked:
 	spin_unlock(&transaction->t_handle_lock);
 	spin_unlock(&journal->j_state_lock);
 out:
-	kfree(new_transaction);
+	if (unlikely(new_transaction))		/* It's usually NULL */
+		kfree(new_transaction);
 	return ret;
 }
 
@@ -724,7 +725,8 @@ done:
 	journal_cancel_revoke(handle, jh);
 
 out:
-	kfree(frozen_buffer);
+	if (unlikely(frozen_buffer))	/* It's usually NULL */
+		kfree(frozen_buffer);
 
 	JBUFFER_TRACE(jh, "exit");
 	return error;
@@ -903,7 +905,8 @@ repeat:
 	jbd_unlock_bh_state(bh);
 out:
 	journal_put_journal_head(jh);
-	kfree(committed_data);
+	if (unlikely(committed_data))
+		kfree(committed_data);
 	return err;
 }
 
_

Patches currently in -mm which might be from akpm@xxxxxxxx are

origin.patch
config_net=n-build-fix.patch
git-acpi.patch
acpi-update-asus_acpi-driver-registration-fix.patch
acpi-memory-hotplug-cannot-manage-_crs-with-plural-resoureces.patch
catch-notification-of-memory-add-event-of-acpi-via-container-driver-register-start-func-for-memory-device.patch
catch-notification-of-memory-add-event-of-acpi-via-container-driveravoid-redundant-call-add_memory.patch
remove-for_each_cpu.patch
sony_apci-resume.patch
powernow-k8-crash-workaround.patch
git-dvb.patch
dvb-core-ule-fixes-and-rfc4326-additions-kernel-2616-tidy.patch
sparc32-vivi-fix.patch
git-dvb-compat-build-fix.patch
bt866-build-fix.patch
connector-exports.patch
opencores-i2c-bus-driver-tidy.patch
git-libata-all.patch
git-mtd.patch
pci-error-recovery-e1000-network-device-driver.patch
powerpc-pseries-avoid-crash-in-pci-code-if-mem-system-not-up-tidy.patch
gregkh-pci-pci-64-bit-resources-drivers-others-changes-amba-fix.patch
git-pcmcia.patch
git-scsi-misc.patch
megaraid-unused-variable.patch
enable-advansys-driver.patch
advansys-warning-workaround.patch
scsi-clean-up-warnings-in-advansys-driver-fix.patch
fix-sco-on-some-bluetooth-adapters-tidy.patch
git-watchdog.patch
pg_uncached-is-ia64-only.patch
migration-remove-unnecessary-pageswapcache-checks-fix.patch
wait_table-and-zonelist-initializing-for-memory-hotadd-wait_table-initialization-fixes.patch
preserve-write-permissions-in-migration-entries-fix.patch
read-write-migration-entries-make-mprotect-convert-write-migration-fix.patch
read-write-migration-entries-make-mprotect-convert-write-migration-fix-fix.patch
read-write-migration-entries-make-mprotect-convert-write-migration-fix-fix-fix.patch
slab-cleanup-kmem_getpages-fix.patch
slab-stop-using-list_for_each-fix.patch
pgdat-allocation-for-new-node-add-specify-node-id-tidy.patch
pgdat-allocation-for-new-node-add-get-node-id-by-acpi-tidy.patch
pgdat-allocation-for-new-node-add-generic-alloc-node_data-tidy.patch
pgdat-allocation-for-new-node-add-export-kswapd-start-func-tidy.patch
mm-introduce-remap_vmalloc_range-fix.patch
acx1xx-wireless-driver.patch
x86-x86_64-avoid-irq0-ioapic-pin-collision-tidy.patch
prune_one_dentry-tweaks.patch
mmput-might-sleep.patch
jbd-avoid-kfree-null.patch
hangcheck-remove-monotomic_clock-on-x86.patch
pi-futex-futex-code-cleanups-fix.patch
reiser4.patch
savagefb-add-state-save-and_restore-hooks-tidy.patch
kgdb-core-lite-add-reboot-command.patch
kgdb-8250-fix.patch
nr_blockdev_pages-in_interrupt-warning.patch
device-suspend-debug.patch
revert-tty-buffering-comment-out-debug-code.patch
slab-leaks3-default-y.patch
x86-kmap_atomic-debugging.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux