I haven't had a working gmail address for many years - update to my
actual working address.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
In case the open() call succeeds but the subsequent fstat() call
fails, then we'll return without close()'ing the filedescriptor.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
"make versioncheck" points out that arch/hexagon/include/asm/spinlock_types.h
does not need to include version.h .
A quick look at the file seems to confirm its findings, so here's a patch that
removes the include.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Richard Kuo <[email protected]>
We currently do this:
int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif)
...
struct wl12xx_arp_rsp_template *tmpl;
struct ieee80211_hdr_3addr *hdr;
...
tmpl = (struct wl12xx_arp_rsp_template *)skb_put(skb, sizeof(*tmpl));
memset(tmpl, 0, sizeof(tmpl));
...
hdr = (struct ieee80211_hdr_3addr *)skb_push(skb, sizeof(*hdr));
memset(hdr, 0, sizeof(hdr));
...
I believe we want to set the entire structures to 0 with those
memset() calls, not just zero the initial part of them (size of the
pointer bytes).
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
The variables 'StatusProcEntry' and 'UserCommandProcEntry' are
assigned to once and then never used. This patch gets rid of the
variables.
While I was there I also fixed the indentation of the function to use
tabs rather than spaces for the lines that did not already do so.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
release_firmware() deals gracefullt with NULL pointers so there's no
reason to test for one prior to calling the function.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Gustavo Padovan <[email protected]>
release_firmware() checks for NULL pointers internally so checking
before calling the function is redundant.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
release_firmware() checks for NULL pointers internally so checking
before calling it is redundant.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Chad Dupuis <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
release_firmware() checks for NULL pointers internally, so checking
before calling the function is redundant.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
release_firmware() checks for NULL pointers - no need to test before
the call.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Andy Gospodarek <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Since release_firmware() deals gracefully with being passed a NULL
pointer there is no reason to test explicitly before calling the
function.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
release_firmware() does its own NULL test so explicit test before call
is unneeded.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Rasesh Mody <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
There is no need to test for a NULL pointer before calling
release_firmware - the function does that on its own.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
There's no need to test for a NULL pointer before calling
release_firmware() since the function does that check itself, so
remove the redundant test.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: David Dillow <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
release_firmware() does its own tests for NULL pointers so there's no
need to explicitly test before calling it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
If the call to mlx4_MAD_IFC() fails in ib_link_query_port() we will
currently do 'return err;' which will leak 'in_mad' and 'out_mad'. We
should instead do 'goto out;' where we'll properly free the memory we
previously allocated.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Or Gerlitz <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
This removes a space between a cast and the variable and makes the
case statements in the switch stylewise consistent as to whether
there's a blank line before each 'case' or not.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Quoted strings that were broken over multiple lines are put on a
single line for easier grep'ability.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Andres Salomon <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
I believe that "trying to access hardware" is more correct English
than "trying access hardware".
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
While reading through sound/soc/codecs/wm8994.c I noticed a fair
amount of trailing whitespace. This patch gets rid of it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
release_firmware() tests for NULL pointers on its own - there's no
reason to do an explicit check before calling the function.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
release_firmware() deals gracefullt with NULL pointers - it's
redundant to check for them before calling the function.
Also remove a few pointless comments - it's rather obvious from the
code that kfree() free's a buffer and that release_firmware() releases
firmware - comments just stating that add no value.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
release_firmware() deals gracefullt with NULL pointers - it's
redundant to check for them before calling the function.
Also remove a few pointless comments - it's rather obvious from the
code that kfree() free's a buffer and that release_firmware() releases
firmware - comments just stating that add no value.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Checking for a NULL pointer before calling release_firmware() is
redundant since the function does that check itself.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
release_firmware() tests for a NULL pointer, so it's redundant to do
that checking before calling it.
Additionally, in ene_load_bincode(), 'sd_fw' is a local variable so
setting it to NULL just before it goes out of scope is completely
pointless, so remove that assignment.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Make free_ipath() behave like most other freeing functions in the
kernel and gracefully do nothing when passed a NULL pointer.
Besides this making the bahaviour consistent with functions such as
kfree(), vfree(), btrfs_free_path() etc etc, it also fixes a real NULL
deref issue in fs/btrfs/ioctl.c::btrfs_ioctl_ino_to_path(). In that
function we have this code:
...
ipath = init_ipath(size, root, path);
if (IS_ERR(ipath)) {
ret = PTR_ERR(ipath);
ipath = NULL;
goto out;
}
...
out:
btrfs_free_path(path);
free_ipath(ipath);
...
If we ever take the true branch of that 'if' statement we'll end up
passing a NULL pointer to free_ipath() which will subsequently
dereference it and we'll go "Boom" :-(
This patch will avoid that.
Signed-off-by: Jesper Juhl <[email protected]>
At the start of the function we assign 'a->d' to 'ap'. Then we use the
RESIZE_IF_NEEDED macro on 'a' - this may free 'a->d' and replace it
with newly allocaetd storage. In that case, we'll be operating on
freed memory further down in the function when we index into 'ap[]'.
Since we don't actually need 'ap' until after the use of the
RESIZE_IF_NEEDED macro we can just delay the assignment to it until
after we've potentially resized, thus avoiding the issue.
While I was there anyway I also changed the integer variable 'n' to be
const. It might as well be since we only assign to it once and use it
as a constant, and then the compiler will tell us if we ever assign to
it in the future.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Dmitry Kasatkin <[email protected]>
Signed-off-by: James Morris <[email protected]>
If either call to pcan_usb_pro_send_req() in
drivers/net/can/usb/peak_usb/pcan_usb_pro.c::pcan_usb_pro_init()
fails, we'll leak the memory we allocated to 'usb_if' with kzalloc()
when the 'usb_if' variable goes out of scope without having been
assigned to anything as we 'return err;'.
Fix this by adding appropriate kfree(usb_if) calls to the error paths.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Stephane Grosjean <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
drivers/gpu/drm/gma500/mdfld_dsi_output.h does not need to
'#include <linux/version.h>' - so don't.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Alan Cox <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
If, in
drivers/net/wireless/ath/ath6kl/debug.c::ath6kl_fwlog_block_read(),
the call to wait_for_completion_interruptible() returns -ERESTARTSYS
then we'll return without freeing the (as yet unused) memory we
allocated for 'buf' - thus leaking it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
If cs42l73_get_mclkx_coeff() returns < 0 (which it can) in
sound/soc/codecs/cs42l73.c::cs42l73_set_mclk(), then we'll be using
the (negative) return value as array index on the very next line of
code - that's bad.
Catch the negative return value and propagate it to the caller (which
checks for it) and things are a bit more sane :-)
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
In sound/pci/hda/patch_realtek.c::alc_auto_fill_dac_nids(), in the
'for (;;)' loop, if the 'badness' value returned from
fill_and_eval_dacs() is negative, then we'll return from the function
without freeing the memory we allocated for 'best_cfg', thus leaking.
Fix the leak by kfree()'ing the memory when badness is negative.
While I was there I also noticed some trailing whitespace in the
function that I removed (along with all other trailing whitespace in
the file) - it didn't seem worth-while to do that as two patches, so I
hope it's OK that I just did it all as one patch.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
If, in __persistent_ram_init(), the call to
persistent_ram_buffer_init() fails or the call to
persistent_ram_init_ecc() fails then we fail to free the memory we
allocated to 'prz' with kzalloc() - thus leaking it.
To prevent the leaks I consolidated all error exits from the function
at a 'err:' label at the end and made all error cases jump to that
label where we can then make sure we always free 'prz'. This is safe
since all the situations where the code bails out happen before 'prz'
has been stored anywhere and although we'll do a redundant kfree(NULL)
call in the case of kzalloc() itself failing that's OK since kfree()
deals gracefully with NULL pointers and I felt it was more important
to keep all error exits at a single location than to avoid that one
harmless/redundant kfree() on a error path.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Colin Cross <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
If copy_to_user() fails in the WLAN_CMD_GET_NODE_LIST case of the
switch in drivers/staging/vt6656/ioctl.c::private_ioctl() we'll leak
the memory allocated to 'pNodeList'. Fix that by kfree'ing the memory
in the failure case.
Also remove a pointless cast (to type 'PSNodeList') of a kmalloc()
return value - kmalloc() returns a void pointer that is implicitly
converted, so there is no need for an explicit cast.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
The release_firmware() function does its own NULL test so a test
before calling it is rather redundant.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
It is redundant to test for NULL pointers before calling
release_firmware() since the function does its own NULL test.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Since release_firmware() does its own test for NULL it is redundant to
do so before calling it.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Bing Zhao <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
release_firmware() tests for, and deals gracefully with, NULL
pointers. Remove redundant explicit tests before calling the function.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
The release_firmware() function does its own NULL test, so testing
before calling it is rather redundant.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
release_firmware() does its own test. Explicitly checking before the
call is redundant.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
The release_firmware() function deals gracefully with being passed a
NULL pointer, so explicit tests before the call are rather pointless.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
If, in drivers/input/misc/da9052_onkey.c::da9052_onkey_probe(), the
call to either kzalloc() or input_allocate_device() fails then we will
return -ENOMEM from the function without freeing the other allocation
that may have succeeded, thus we leak either the memory allocated for
'onkey' or the memory allocated for 'input_dev' if one succeeds and
the other fails.
Fix that by jumping to the 'err_free_mem' label at the end of the
function that properly cleans up rather than returning directly.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
If, in drivers/staging/media/as102/as102_fw.c::as102_fw_upload(), the call
cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL);
should fail and return NULL so that we jump to the 'error:' label,
then we'll end up calling 'release_firmware(firmware);' with
'firmware' still uninitialized - not good.
The easy fix is to just initialize 'firmware' to NULL when we declare
it, since release_firmware() deals gracefully with being passed NULL
pointers.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
There's a lot of trailing whitespace in drivers/telephony/ixj.c .
This patch removes it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
If, in drivers/staging/media/as102/as102_fw.c::as102_fw_upload(), the call
cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL);
should fail and return NULL so that we jump to the 'error:' label,
then we'll end up calling 'release_firmware(firmware);' with
'firmware' still uninitialized - not good.
The easy fix is to just initialize 'firmware' to NULL when we declare
it, since release_firmware() deals gracefully with being passed NULL
pointers.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
release_firmware() does its own NULL ptr testing, it's redundant to
also test before calling it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Break a few lines that go way over the usual 80 column limit that we prefer.
Also adjust the placement of a few line continuations.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
In drivers/platform/x86/amilo-rfkill.c::amilo_rfkill_probe() the call
to dmi_first_match() may fail and return NULL. If it does return NULL,
then we'll be dereferencing a NULL pointer in the rfkill_alloc() call
where we do 'system_id->driver_data' --> KABOOM!
Avoid that problem by testing for a NULL return value from
dmi_first_match() and bailing out if it fails.
I was a bit uncertain about what to return in the failure case. In the
end I settled for -ENXIO as the most logical error to return.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
In cx231xx_v4l2_close() there are two calls to
cx231xx_release_resources(dev) followed by kfree(dev). That is a
problem since cx231xx_release_resources() already kfree()'s its
argument, so we end up doing a double free.
Easily resolved by just removing the redundant kfree() calls after the
calls to cx231xx_release_resources().
I also changed the 'dev = NULL' assignments (which are rather
pointless since 'dev' is about to go out of scope), to 'fh->dev = NULL'
since it looks to me that that is what was actually intended.
And I removed the 'dev = NULL' assignment at the end of
cx231xx_release_resources() since it is pointless.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
In psb_intel_lvds_init(), if we fail to allocate memory for
'psb_intel_connector' we free the memory we previously allocated for
'psb_intel_encoder', but we then proceed to use that free'd pointer
when we do 'psb_intel_encoder->dev_priv = lvds_priv;'.
We may also leak the memory we allocated for 'psb_intel_encoder' if we
'goto failed_connector;' and the variable goes out of scope.
While I was there anyway, I also removed the pointless 'if
(psb_intel_connector)' before freeing it at the 'failed_connector:'
label - kfree() deals gracefully with NULL pointers, so it is not
needed.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
If 'argc' is zero we jump to the 'out:' label, but this leaks the
(unused) memory that 'dm_split_args()' allocated for 'argv' if the
string being split consisted entirely of whitespace. Jump to the
'out_argv:' label instead to free up that memory.
Signed-off-by: Jesper Juhl <[email protected]>
Cc: [email protected]
Signed-off-by: Alasdair G Kergon <[email protected]>
As 'make versioncheck' points out, there's no need for
drivers/mfd/ab5500-core.c to #include <linux/version.h>, so this patch
removes the unneeded include.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
As the coverity checker puts it:
"Passing argument "sizeof (midi_function) /*8*/" to function "kcalloc"
and then casting the return value to "struct usb_descriptor_header **"
is suspicious. ... In this particular case sizeof(struct
usb_descriptor_header **) happens to be equal to sizeof(struct
usb_descriptor_header *), but this is not a portable assumption."
I believe we really do intend to use 'sizeof(*midi_function)' here, so
this patch makes that change.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
One semi-colon at the end of the return statement is sufficient.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Sascha Hauer <[email protected]>
There's no need for drivers/block/nvme.c to include linux/version.h,
so remove the include.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
If 'drv_fcxp = kzalloc(sizeof(struct bfad_fcxp), GFP_KERNEL);' fails
and returns NULL, then we'll leak the memory allocated to 'bsg_fcpt'
when we jump to 'out:' and the variable subsequently goes out of
scope.
Also remove the cast of the kzalloc() return value. kzalloc() returns
a void* which is implicitly converted, so the explicit cast is
pointless.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Krishna Gudipati <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
In drivers/staging/rtl8192e/rtllib_softmac.c::rtllib_rx_assoc_resp()
we allocate memory for 'network' with kzalloc() and then proceed to
zero the already zeroed mem we got from kzalloc() with
memset(). That's redundant, so remove the memset()
We also fail to kfree() the memory we allocated for 'network' if we do not enter
if (ieee->current_network.qos_data.supported == 1) {
and the variable then goes out of scope.
To fix that I simply moved the kfree() that was inside that 'if'
statement to instead be just after it. It then covers both the case
where we take the branch and when we don't.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Larry Finger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
We can never reach the line just after the 'return 0'
statement. Remove it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
It looks to me like the two ASSERT()s in xfs_trans_add_item() really
want to do a compare (==) rather than assignment (=).
This patch changes it from the latter to the former.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
(cherry picked from commit 05293485a0)
It looks to me like the two ASSERT()s in xfs_trans_add_item() really
want to do a compare (==) rather than assignment (=).
This patch changes it from the latter to the former.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
There's no need to include the header twice, so get rid of the
duplicate.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
If allocating 'pdata_urb' fails, the function will return -ENOMEM
without freeing the memory allocated, just a few lines above, for
'purb' and will leak that memory when 'purb' goes out of scope.
This patch resolves the leak by freeing the allocated storage with
usb_free_urb() before the return.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
If we hit the default case in the switch statement in wpa_ioctl()
we'll leak the memory allocated to 'param' when the variable goes out
of scope without having been assigned to anything.
This patch fixes the leak by kfree()'ing the memory before we return
from the function.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This patch cleans up the coding style in
drivers/staging/vt6656/wpactl.c to closer match the generally accepted
kernel CodingStyle. It is by no means a "make it perfect" patch, but
it does get the file a fair bit closer to matching the accepted style
(whomever was involved in the evolution of this file seriously need to
configure their editors to maintain a consistent style - it was a
mess).
Besides pure style cleanups I also took the liberty of removing some
pointless parens, some unneeded casts and removing some commented out code
(it was obviously not used and git has it if it's ever needed in the
future).
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
If allocating 'pdata_urb' fails, the function will return -ENOMEM
without freeing the memory allocated, just a few lines above, for
'purb' and will leak that memory when 'purb' goes out of scope.
This patch resolves the leak by freeing the allocated storage with
usb_free_urb() before the return.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
In tm6000_ir_fini() there seems to be a problem.
rc_unregister_device(ir->rc); calls rc_free_device() on the pointer it is
given, which frees it.
Subsequently the function does:
if (!ir->polling)
__tm6000_ir_int_stop(ir->rc);
and __tm6000_ir_int_stop() dereferences the pointer it is given, which
has already been freed.
and it also does:
tm6000_ir_stop(ir->rc);
which also dereferences the (already freed) pointer.
So, it seems that the call to rc_unregister_device() should be move
below the calls to __tm6000_ir_int_stop() and tm6000_ir_stop(), so
those don't operate on a already freed pointer.
But, I must admit that I don't know this code *at all*, so someone who
knows the code should take a careful look before applying this
patch. It is based purely on inspection of facts of what is beeing
freed where and not at all on understanding what the code does or why.
I don't even have a means to test it, so beyond testing that the
change compiles it has seen no testing what-so-ever.
Anyway, here's a proposed patch.
Signed-off-by: Jesper Juhl <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
We allocate memory for 'new_data' with kmalloc(). If we get the memory
we then try to build_skb() and if that should fail (which it can) we
do not enter 'if (likely(skb)) {' and actually use 'new_data' but
instead fall through to the 'drop:' label and end up returning from
the function without ever assigning 'new'data' to anything or freeing
it. That leaks the memory allocated to 'new_data'.
This patch fixes the memory leak by doing a kfree(new_data) in the
case where build_skb() fails (or where allocation of 'new_data' itself
fails, but in taht case it's just a harmless kfree(NULL)).
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Acked-by: Eilon Greenstein <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
The header 'linux/moduleparam.h' is included twice in
'sound/isa/sb/emu8000_patch.c'. Once is enough.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
The variable 'neigh' is assigned to, but otherwise completely
unused. So let's remove it.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
The code is not going to be removed, so remove the comment stating
that it will be.
Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
We declare 'exact' without initializing it and then do:
[...]
if (strlen(p->cru_driver_name))
exact = 1;
if (priority && !exact)
return -EINVAL;
[...]
If the first 'if' is not true, then the second will test an
uninitialized 'exact'.
As far as I can tell, what we want is for 'exact' to be initialized to
0 (zero/false).
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Steffen Klassert <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
In psb_intel_lvds_init(), if we fail to allocate memory for
'psb_intel_connector' we free the memory we previously allocated for
'psb_intel_encoder', but we then proceed to use that free'd pointer
when we do 'psb_intel_encoder->dev_priv = lvds_priv;'.
We may also leak the memory we allocated for 'psb_intel_encoder' if we
'goto failed_connector;' and the variable goes out of scope.
While I was there anyway, I also removed the pointless 'if
(psb_intel_connector)' before freeing it at the 'failed_connector:'
label - kfree() deals gracefully with NULL pointers, so it is not
needed.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Patrik Jakobsson <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
As 'make versioncheck' so nicely points out, there's no need for
drivers/mfd/ab5500-core.c to #include the linux/version.h header.
This patch removes the pointless include.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
As 'make versioncheck' points out, drivers/md/dm-bufio.c has no need to include
linux/version.h, so this patch removes the unneeded include.
Signed-off-by: Jesper Juhl <[email protected]>
Acked-by: Mikulas Patocka <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>