summaryrefslogtreecommitdiff
path: root/drivers/media/radio/wl128x/fmdrv_common.c
AgeCommit message (Collapse)Author
2020-01-29media: wl128x: Fix an error code in fm_download_firmware()Dan Carpenter
[ Upstream commit ef4bb63dc1f7213c08e13f6943c69cd27f69e4a3 ] We forgot to set "ret" on this error path. Fixes: e8454ff7b9a4 ("[media] drivers:media:radio: wl128x: FM Driver Common sources") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-05-31media: wl128x: prevent two potential buffer overflowsDan Carpenter
[ Upstream commit 9c2ccc324b3a6cbc865ab8b3e1a09e93d3c8ade9 ] Smatch marks skb->data as untrusted so it warns that "evt_hdr->dlen" can copy up to 255 bytes and we only have room for two bytes. Even if this comes from the firmware and we trust it, the new policy generally is just to fix it as kernel hardenning. I can't test this code so I tried to be very conservative. I considered not allowing "evt_hdr->dlen == 1" because it doesn't initialize the whole variable but in the end I decided to allow it and manually initialized "asic_id" and "asic_ver" to zero. Fixes: e8454ff7b9a4 ("[media] drivers:media:radio: wl128x: FM Driver Common sources") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2016-07-17drivers: misc: ti-st: Use int instead of fuzzy char for callback statusGeert Uytterhoeven
On mips and parisc: drivers/bluetooth/btwilink.c: In function 'ti_st_open': drivers/bluetooth/btwilink.c:174:21: warning: overflow in implicit constant conversion [-Woverflow] hst->reg_status = -EINPROGRESS; drivers/nfc/nfcwilink.c: In function 'nfcwilink_open': drivers/nfc/nfcwilink.c:396:31: warning: overflow in implicit constant conversion [-Woverflow] drv->st_register_cb_status = -EINPROGRESS; There are actually two issues: 1. Whether "char" is signed or unsigned depends on the architecture. As the completion callback data is used to pass a (negative) error code, it should always be signed. 2. EINPROGRESS is 150 on mips, 245 on parisc. Hence -EINPROGRESS doesn't fit in a signed 8-bit number. Change the callback status from "char" to "int" to fix these. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2016-02-01[media] wl128x: fix typo in MODULE_PARM_DESCDan Carpenter
The module_param() is "default_rds_buf" and the MODULE_PARM_DESC() should match. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06[media] wl128x: use swap() in fm_rdsparse_swapbytes()Fabian Frederick
Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-24[media] wl128x: fix fmdbg compiler warningHans Verkuil
fmdrv_common.c: In function 'fm_download_firmware': fmdrv_common.c:1259:2: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=] fmdbg("Firmware(%s) length : %d bytes\n", fw_name, fw_entry->size); ^ Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-03[media] wl128x: fix sparse warningsHans Verkuil
drivers/media/radio/wl128x/fmdrv_common.c:598:32: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:598:32: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:598:32: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:598:32: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:767:38: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:767:38: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:767:38: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:767:38: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:992:21: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:992:21: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:992:21: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:992:21: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:443:41: warning: incorrect type in assignment (different base types) drivers/media/radio/wl128x/fmdrv_common.c:1359:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:39: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:39: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:39: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1359:39: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:25: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:25: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:25: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:25: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:47: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:47: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:47: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_common.c:1368:47: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:119:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:119:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:119:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:119:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:192:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:192:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:192:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:192:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:288:28: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:288:28: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:288:28: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:288:28: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:534:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:534:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:534:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:534:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:625:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:625:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:625:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_rx.c:625:17: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_tx.c:377:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_tx.c:377:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_tx.c:377:20: warning: cast to restricted __be16 drivers/media/radio/wl128x/fmdrv_tx.c:377:20: warning: cast to restricted __be16 Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-15[media] fmdrv_common: fix sparse warningHans Verkuil
drivers/media/radio/wl128x/fmdrv_common.c:178:6: warning: symbol 'g_st_write' was not declared. Should it be static? Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-05-21[media] wl128x: do not call copy_to_user() while holding spinlocksAlexey Khoroshilov
copy_to_user() must not be called with spinlocks held, but it is in fmc_transfer_rds_from_internal_buff(). The patch copies data to tmpbuf, releases spinlock and then passes it to userspace. By the way there is a small unification: replace a couple of hardcoded constants by a macro. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27[media] wl128x: Replace memcpy with struct assignmentEzequiel Garcia
This kind of memcpy() is error-prone. Its replacement with a struct assignment is prefered because it's type-safe and much easier to read. Found by coccinelle. Hand patched and reviewed. Tested by compilation only. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier struct_name; struct struct_name to; struct struct_name from; expression E; @@ -memcpy(&(to), &(from), E); +to = from; // </smpl> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-28[media] fmdrv: Don't check if unsigned are below zeroMauro Carvalho Chehab
drivers/media/radio/wl128x/fmdrv_common.c:745:3: warning: comparison is always false due to limited range of data type [-Wtype-limits] drivers/media/radio/wl128x/fmdrv_rx.c:308:2: warning: comparison is always false due to limited range of data type [-Wtype-limits] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-30[media] wl128x: fmdrv_common: fix signedness bugsXi Wang
Message-Id: <1322820073-19347-2-git-send-email-xi.wang@gmail.com> The error handling with (ret < 0) didn't work where ret is a u32. Use int instead. To be consistent we also change the functions to return an int. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-04-07Merge branch 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6Linus Torvalds
* 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6: Fix common misspellings
2011-03-31[media] radio: wl128x: Update registration process with STManjunatha Halli
As underlying ST driver registration API's have changed with latest 2.6.38-rc8 kernel this patch will update the FM driver accordingly. Signed-off-by: Manjunatha Halli <manjunatha_halli@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-22[media] fmdrv_common.c: fix compiler warningHans Verkuil
drivers/media/radio/wl128x/fmdrv_common.c: In function 'recv_tasklet': drivers/media/radio/wl128x/fmdrv_common.c:274:4: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' The result of sizeof() should be printed with %zu. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21[media] drivers:media:radio: wl128x: FM Driver Common sourcesManjunatha Halli
These are the sources for the common interfaces required by the FM V4L2 driver for TI WL127x and WL128x chips. These implement the FM channel-8 protocol communication with the chip. This makes use of the Shared Transport as its transport. Signed-off-by: Manjunatha Halli <manjunatha_halli@ti.com> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>