Your upstream maintainer just isn't that into you...
Subsystems (29)
A message that is not in the archive (sent off-list or not yet received): CAA9_cmeNagC1sF54BAHa1sTzL3sMD3eKoftHQHCM5q9vKq5Dyg@mail.gmail.com
Quoted 2 lines · Dan Williams
Can we do a better job of bounding the maximum latency for acceptance or rejection of a patch?
I sent quite a few patches all over the kernel as part of my Smatch work. If I don't get feedback on my patch then I assume it will be merged. I've gone through my sent-mail box and collected the patches which weren't merged. Hopefully, this is useful in discussing maintainer submitter feedback.
Some of these patches are probably wrong but it would have been nice to get some feedback on that.
The SCSI subsystem obviously stands out as pretty bad. It's the only subsystem where you can send a patch over and over and not get a response. It's not that I think all my patches should be merged without any review and free hugs for everyone... For all the other patches in this list, I feel that the patches was dropped by mistake but in SCSI it was silently ignored as a policy.
Causes of patches being lost:
* Poor changelog on a cleanup patch.
* I didn't CC the person who introduced the bug so I never got their acked-by.
* The patch wasn't obvious and the maintainer was planning to review it later and forgot.
* Confusion about who was supposed to pull a patch.
* Poor communication between the maintainer and me and I didn't realize they wanted me to redo the patch. Don't phrase your statements as questions.
regards,
dan carpenter
PATCH 1/1 bfa: off by one in bfa_ioc_mbox_isr()
If mc = BFI_MC_MAX then we're reading past the end of the mod->mbhdlr[] array.
---
Originally sent on Wed, 6 Jul 2011.
drivers/scsi/bfa/bfa_ioc.c +1 -1
@@ -2357,7 +2357,7 @@ bfa_ioc_mbox_isr(struct bfa_ioc_s *ioc)return ; } -if ((mc >BFI_MC_MAX ) || (mod->mbhdlr[mc].cbfn =NULL )) +if ((mc >=BFI_MC_MAX ) || (mod->mbhdlr[mc].cbfn =NULL ))return ; mod->mbhdlr[mc].cbfn (mod->mbhdlr[mc].cbarg, &m);
RE: [patch -resend] [SCSI] bfa: off by one in bfa_ioc_mbox_isr()
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, June 27, 2012 2:00 AM
To: Jing Huang
Cc: Krishna Gudipati; James E.J. Bottomley; [email protected]; [email protected]; [email protected]
Subject: [patch -resend] [SCSI] bfa: off by one in bfa_ioc_mbox_isr()
If mc = BFI_MC_MAX then we're reading past the end of the mod->mbhdlr[] array.
---
Originally sent on Wed, 6 Jul 2011.
drivers/scsi/bfa/bfa_ioc.c +1 -1
@@ -2357,7 +2357,7 @@ bfa_ioc_mbox_isr(struct bfa_ioc_s *ioc)return ; } -if ((mc >BFI_MC_MAX ) || (mod->mbhdlr[mc].cbfn =NULL )) +if ((mc >=BFI_MC_MAX ) || (mod->mbhdlr[mc].cbfn =NULL ))return ; mod->mbhdlr[mc].cbfn (mod->mbhdlr[mc].cbarg, &m);
-----
Thanks for the patch.
PATCH 1/1 bfa: dereferencing freed memory in bfad_im_probe()
In reply to Dan CarpenterIf bfad_thread_workq(bfad) was not BFA_STATUS_OK then we freed "im" and then dereferenced it.
I did a little clean up because it seemed nicer to return directly instead of doing a superfluous goto. I looked at other functions in this file and it seems like returning directly is standard.
---
This is the third time I have sent this patch. It was previously sent on Fri, 29 Jul 2011 and Wed, 29 Feb 2012.
drivers/scsi/bfa/bfad_im.c +4 -8
@@ -687,25 +687,21 @@ bfa_status_t bfad_im_probe(struct bfad_s *bfad) {struct bfad_im_s *im; -bfa_status_t rc =BFA_STATUS_OK ; im =kzalloc (sizeof (struct bfad_im_s ),GFP_KERNEL ); -if (im =NULL ) { - rc =BFA_STATUS_ENOMEM ; - goto ext; - } +if (im =NULL ) +return BFA_STATUS_ENOMEM ; bfad->im = im; im->bfad = bfad;if (bfad_thread_workq (bfad) !=BFA_STATUS_OK ) {kfree (im); - rc =BFA_STATUS_FAILED ; +return BFA_STATUS_FAILED ; }INIT_WORK (&im->aen_im_notify_work, bfad_aen_im_notify_handler); -ext: -return rc; +return BFA_STATUS_OK ; }void
RE: [patch -resend] [SCSI] bfa: dereferencing freed memory in bfad_im_probe()
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, June 27, 2012 2:00 AM
To: Jing Huang
Cc: Krishna Gudipati; James E.J. Bottomley; [email protected]; [email protected]; [email protected]
Subject: [patch -resend] [SCSI] bfa: dereferencing freed memory in bfad_im_probe()
If bfad_thread_workq(bfad) was not BFA_STATUS_OK then we freed "im" and then dereferenced it.
I did a little clean up because it seemed nicer to return directly instead of doing a superfluous goto. I looked at other functions in this file and it seems like returning directly is standard.
---
This is the third time I have sent this patch. It was previously sent on Fri, 29 Jul 2011 and Wed, 29 Feb 2012.
drivers/scsi/bfa/bfad_im.c +4 -8
@@ -687,25 +687,21 @@ bfa_status_t bfad_im_probe(struct bfad_s *bfad) {struct bfad_im_s *im; -bfa_status_t rc =BFA_STATUS_OK ; im =kzalloc (sizeof (struct bfad_im_s ),GFP_KERNEL ); -if (im =NULL ) { - rc =BFA_STATUS_ENOMEM ; - goto ext; - } +if (im =NULL ) +return BFA_STATUS_ENOMEM ; bfad->im = im; im->bfad = bfad;if (bfad_thread_workq (bfad) !=BFA_STATUS_OK ) {kfree (im); - rc =BFA_STATUS_FAILED ; +return BFA_STATUS_FAILED ; }INIT_WORK (&im->aen_im_notify_work, bfad_aen_im_notify_handler); -ext: -return rc; +return BFA_STATUS_OK ; }void
-----
Thanks for the patch.
PATCH 1/1 megaraid: remove a spurious IRQ enable
In reply to Dan CarpenterWe took this lock with spin_lock() so we should unlock it with spin_unlock() instead of spin_unlock_irq(). This was introduced in f2c8dc402b "[SCSI] megaraid_mbox: remove scsi_assign_lock usage".
---
This was originally sent on Sat, 30 Jul 2011. I have cleaned up the commit message a bit and added Christoph to the CC list.
drivers/scsi/megaraid/megaraid_mbox.c +1 -1
@@ -2731,7 +2731,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp) } out: -spin_unlock_irq (&adapter->lock); +spin_unlock (&adapter->lock);return rval; }
Re: [patch -resend] [SCSI] megaraid: remove a spurious IRQ enable
Quoted 22 lines · Dan Carpenter
We took this lock with
spin_lock()so we should unlock it withspin_unlock()instead ofspin_unlock_irq(). This was introduced inf2c8dc402b"[SCSI]megaraid_mbox: removescsi_assign_lockusage".Signed-off-by Dan Carpenter <[email protected]>---
This was originally sent on Sat, 30 Jul 2011. I have cleaned up the commit message a bit and added Christoph to the CC list.drivers/scsi/megaraid/megaraid_mbox.c +0
-0@@ -2731,7 +2731,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp) }out:
-spin_unlock_irq(&adapter->lock);
+spin_unlock(&adapter->lock);
return rval;
}
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/2 SCSI: advansys: handle errors from scsi_dma_map()
In reply to Dan Carpenterscsi_dma_map() returns -ENOMEM on error.
---
Originally sent on Tue, 20 Sep 2011.
drivers/scsi/advansys.c +6 -0
@@ -8426,6 +8426,12 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,/* Build ASC_SCSI_Q */ use_sg =scsi_dma_map (scp); +if (use_sg <0 ) { +scsi_dma_unmap (scp); + scp->result =HOST_BYTE (DID_SOFT_ERROR ); +return ASC_ERROR ; + } +if (use_sg !=0 ) {int sgcnt;struct scatterlist *slp;
Re: [patch 1/2 -resend] SCSI: advansys: handle errors from scsi_dma_map()
Am 27.06.2012 11:00, schrieb Dan Carpenter:
Quoted 13 lines
scsi_dma_map()returns-ENOMEMon error.Signed-off-by Dan Carpenter <[email protected]>---
Originally sent on Tue, 20 Sep 2011.drivers/scsi/advansys.c +0
-0@@ -8426,6 +8426,12 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,/* Build ASC_SCSI_Q */
drivers/scsi/advansys.c static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, · line 8437
Quoted 10 lines
drivers/scsi/advansys.c +6
-0use_sg =scsi_dma_map (scp); +if (use_sg <0 ) { +scsi_dma_unmap (scp); + scp->result =HOST_BYTE (DID_SOFT_ERROR ); +return ASC_ERROR ; + } +if (use_sg !=0 ) {int sgcnt;struct scatterlist *slp;
Q:if use_sg = 0 a special case ?
re,
wh
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 1/2 -resend] SCSI: advansys: handle errors from scsi_dma_map()
Quoted 15 lines · walter harms
Am 27.06.2012 11:00, schrieb Dan Carpenter:
Quoted 12 lines
scsi_dma_map()returns-ENOMEMon error.Signed-off-by Dan Carpenter <[email protected]>---
Originally sent on Tue, 20 Sep 2011.drivers/scsi/advansys.c +0
-0@@ -8426,6 +8426,12 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
Quoted 14 lines
drivers/scsi/advansys.c static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, · line 8437
Quoted 11 lines
drivers/scsi/advansys.c +6
-0/* Build ASC_SCSI_Q */ use_sg =scsi_dma_map (scp); +if (use_sg <0 ) { +scsi_dma_unmap (scp); + scp->result =HOST_BYTE (DID_SOFT_ERROR ); +return ASC_ERROR ; + } +if (use_sg !=0 ) {int sgcnt;struct scatterlist *slp;Q:if
use_sg= 0 a special case ?
Yes. scsi_dma_map() returns the number of sg lists actually used, zero if the sg lists is NULL, or -ENOMEM if the mapping failed.
regards,
dan carpenter
PATCH 1/2 dma-debug: debugfs_create_bool() takes a u32 pointer
In reply to Dan CarpenterEven though it has "bool" in the name, you have pass a u32 pointer to debugfs_create_bool(). Otherwise you get memory corruption in write_file_bool(). Fortunately in this case the corruption happens in an alignment hole between variables so it doesn't cause any problems.
---
This was sent on Fri, 2 Mar 2012.
It's probably my fault the bug is still there. I submitted the patch but the feed back was that debugfs_create_bool() has a stupid API and should take a pointer to a bool. I said that yes, probably that is true but only two places use the current API incorrectly and I fixed the other place as well.
I assumed that both my patches would be merged and the person who cared about API would fix the API but neither of my fixes were applied.
lib/dma-debug.c +2 -2
@@ -78,7 +78,7 @@ static LIST_HEAD(free_entries);static DEFINE_SPINLOCK (free_entries_lock);/* Global disable flag - will be set in case of an error */ -static bool global_disable__read_mostly ; +static u32 global_disable__read_mostly ;/* Global error count */ static u32 error_count;
@@ -657,7 +657,7 @@ static int dma_debug_fs_init(void) global_disable_dent =debugfs_create_bool ("disabled" ,0444 , dma_debug_dent, - (u32 *)&global_disable); + &global_disable);if (!global_disable_dent) goto out_err;
Re: [patch 1/2 -resend] dma-debug: debugfs_create_bool() takes a u32 pointer
Quoted 6 lines · Dan Carpenter
Even though it has "bool" in the name, you have pass a u32 pointer to
debugfs_create_bool(). Otherwise you get memory corruption inwrite_file_bool(). Fortunately in this case the corruption happens in an alignment hole between variables so it doesn't cause any problems.Signed-off-by Dan Carpenter <[email protected]>
Quoted 35 lines
---
This was sent on Fri, 2 Mar 2012.It's probably my fault the bug is still there. I submitted the patch but the feed back was that
debugfs_create_bool()has a stupid API and should take a pointer to a bool. I said that yes, probably that is true but only two places use the current API incorrectly and I fixed the other place as well.I assumed that both my patches would be merged and the person who cared about API would fix the API but neither of my fixes were applied.
lib/dma-debug.c +2
-2@@ -78,7 +78,7 @@ static LIST_HEAD(free_entries);static DEFINE_SPINLOCK (free_entries_lock);/* Global disable flag - will be set in case of an error */ -static bool global_disable__read_mostly ; +static u32 global_disable__read_mostly ;/* Global error count */ static u32 error_count;@@ -657,7 +657,7 @@ static int dma_debug_fs_init(void) global_disable_dent =debugfs_create_bool ("disabled" ,0444 , dma_debug_dent, - (u32 *)&global_disable); + &global_disable);if (!global_disable_dent) goto out_err;
Joerg Roedel
AppliedRe: [patch 1/2 -resend] dma-debug: debugfs_create_bool() takes a u32 pointer
In reply to Dan CarpenterQuoted 6 lines · Dan Carpenter
Even though it has "bool" in the name, you have pass a u32 pointer to
debugfs_create_bool(). Otherwise you get memory corruption inwrite_file_bool(). Fortunately in this case the corruption happens in an alignment hole between variables so it doesn't cause any problems.Signed-off-by Dan Carpenter <[email protected]>
Applied both, thanks Dan.
PATCH 1/1 9p: fix min_t() casting in p9pdu_vwritef()
In reply to Dan CarpenterI don't think we're actually likely to hit this limit but if we do then the comparison should be done as size_t. The original code is equivalent to:
len = strlen(sptr) % USHRT_MAX;
---
I was told this patch "has already made it upstream via the v9fs pull." but it must have been dropped accidentally. Originally sent on Sat, Jan 15, 2011.
net/9p/protocol.c +1 -1
@@ -368,7 +368,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, const char *sptr = va_arg(ap, const char *);uint16_t len =0 ;if (sptr) - len =min_t (uint16_t,strlen (sptr), + len =min_t (size_t,strlen (sptr),USHRT_MAX ); errcode = p9pdu_writef(pdu, proto_version,
Re: [patch -resend] 9p: fix min_t() casting in p9pdu_vwritef()
Am 27.06.2012 11:01, schrieb Dan Carpenter:
Quoted 16 lines
I don't think we're actually likely to hit this limit but if we do then the comparison should be done as
size_t. The original code is equivalent to:len = strlen(sptr) % USHRT_MAX;Signed-off-by Dan Carpenter <[email protected]>---
I was told this patch "has already made it upstream via the v9fs pull." but it must have been dropped accidentally. Originally sent on Sat, Jan 15, 2011.net/9p/protocol.c +0
-0
net/9p/protocol.c p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, · line 374
Quoted 8 lines
net/9p/protocol.c +1
-1@@ -368,7 +368,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, const char *sptr = va_arg(ap, const char *);uint16_t len =0 ;if (sptr) - len =min_t (uint16_t,strlen (sptr), + len =min_t (size_t,strlen (sptr),USHRT_MAX ); errcode = p9pdu_writef(pdu, proto_version,
this will result in
uint16_t = size_t
i would expect compilers to complains since uint16 < size_t (most times). In this special case it seems more easy write it. also ushort seems ambitious since uint16_t need not to be ushort. so my idea would look like this:
len=strlen if (len>65535) lene535; p9pdu_writef(...,(unint16_t)len);
just my 2 cents,
wh
Re: [patch -resend] 9p: fix min_t() casting in p9pdu_vwritef()
Quoted 30 lines · walter harms
Am 27.06.2012 11:01, schrieb Dan Carpenter:
Quoted 16 lines
I don't think we're actually likely to hit this limit but if we do then the comparison should be done as
size_t. The original code is equivalent to:len = strlen(sptr) % USHRT_MAX;Signed-off-by Dan Carpenter <[email protected]>---
I was told this patch "has already made it upstream via the v9fs pull." but it must have been dropped accidentally. Originally sent on Sat, Jan 15, 2011.net/9p/protocol.c +0
-0net/9p/protocol.c p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, · line 374
Quoted 8 lines
net/9p/protocol.c +1
-1@@ -368,7 +368,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, const char *sptr = va_arg(ap, const char *);uint16_t len =0 ;if (sptr) - len =min_t (uint16_t,strlen (sptr), + len =min_t (size_t,strlen (sptr),USHRT_MAX ); errcode = p9pdu_writef(pdu, proto_version,this will result in
uint16_t = size_t
Quoted 9 lines
i would expect compilers to complains since uint16 <
size_t(most times). In this special case it seems more easy write it. also ushort seems ambitious sinceuint16_tneed not to be ushort. so my idea would look like this:len=strlen if (len>65535) lene535; p9pdu_writef(...,(unint16_t)len);
No. I'm sorry, what you're saying is complete nonsense. The whole point of min_t() is that you can cast to both sides to what you want before you do the compare.
Obviously I wouldn't submit a patch that introduces a compile warning. :/
regards,
dan carpenter
Re: [patch -resend] 9p: fix min_t() casting in p9pdu_vwritef()
In reply to Dan CarpenterAm 27.06.2012 12:36, schrieb Dan Carpenter:
Quoted 41 lines · walter harms
Quoted 30 lines
Am 27.06.2012 11:01, schrieb Dan Carpenter:
Quoted 16 lines
I don't think we're actually likely to hit this limit but if we do then the comparison should be done as
size_t. The original code is equivalent to:len = strlen(sptr) % USHRT_MAX;Signed-off-by Dan Carpenter <[email protected]>---
I was told this patch "has already made it upstream via the v9fs pull." but it must have been dropped accidentally. Originally sent on Sat, Jan 15, 2011.net/9p/protocol.c +0
-0net/9p/protocol.c p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, · line 374
Quoted 8 lines
net/9p/protocol.c +1
-1@@ -368,7 +368,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, const char *sptr = va_arg(ap, const char *);uint16_t len =0 ;if (sptr) - len =min_t (uint16_t,strlen (sptr), + len =min_t (size_t,strlen (sptr),USHRT_MAX ); errcode = p9pdu_writef(pdu, proto_version,this will result in
uint16_t = size_tQuoted 9 lines
i would expect compilers to complains since uint16 <
size_t(most times). In this special case it seems more easy write it. also ushort seems ambitious sinceuint16_tneed not to be ushort. so my idea would look like this:len=strlen if (len>65535) lene535; p9pdu_writef(...,(unint16_t)len);
Quoted 7 lines
No. I'm sorry, what you're saying is complete nonsense. The whole point of
min_t()is that you can cast to both sides to what you want before you do the compare.Obviously I wouldn't submit a patch that introduces a compile warning. :/
i figured it out (i hope) uint16_t is internally long unsigned int not short as i expected. sorry for the noise.
re,
wh
Re: [patch -resend] 9p: fix min_t() casting in p9pdu_vwritef()
In reply to Dan CarpenterFrom: Dan Carpenter <[email protected]>
Date: Wed, 27 Jun 2012 12:01:41 +0300
Quoted 6 lines
I don't think we're actually likely to hit this limit but if we do then the comparison should be done as
size_t. The original code is equivalent to:len = strlen(sptr) % USHRT_MAX;Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks Dan.
PATCH 1/1 spi/spidev: handle integer wrap in spidev_message()
In reply to Dan Carpenter"k_tmp->len" and "total" are unsigned integers. The first message could be close to "bufsiz" (4096) and then the next message could be 4GB which would cause an integer overflow.
---
I don't have a way to test this. I originally sent this message on Tue, 18 Oct 2011. I'm not totally sure what the implications are but it seemed like there might be security implications. I honestly don't know. I never received any feedback on the patch.
drivers/spi/spidev.c +1 -1
@@ -241,7 +241,7 @@ static int spidev_message(struct spidev_data *spidev, k_tmp->len = u_tmp->len; total += k_tmp->len; -if (total > bufsiz) { +if (total > bufsiz || total < k_tmp->len) { status = -EMSGSIZE ; goto done; }
PATCH 1/1 mmc: ushc: fix an endianness conversion in ushc_request()
In reply to Dan CarpenterThe ->cmd_idx field is 8 bits, not 16 so the call to cpu_to_le16() will probably set cmd_idx to zero here on big endian systems. My guess is that this works because it has been tested on little endian systems where the conversion to le16 is a nop.
---
I don't have a way to test this.
I have added a sentence to the changelog. I have added David Vrabel to the CC list. This was originally sent to the mailing list on Mon, 21 Nov 2011 and there was no response.
drivers/mmc/host/ushc.c +1 -1
@@ -278,7 +278,7 @@ static void ushc_request(struct mmc_host *mmc, struct mmc_request *req) ushc->current_req = req;/* Start cmd with CBW. */ - ushc->cbw->cmd_idx =cpu_to_le16 (req->cmd->opcode); + ushc->cbw->cmd_idx = req->cmd->opcode;if (req->data) ushc->cbw->block_size =cpu_to_le16 (req->data->blksz);else
PATCH 1/1 sgi-xp: nested calls to spin_lock_irqsave()
In reply to Dan CarpenterThe code here has a nested spin_lock_irqsave(). It's not needed since IRQs are already disabled and it causes a problem because it means that IRQs won't be enabled again at the end. The second call to spin_lock_irqsave() will overwrite the value of irq_flags and we can't restore the proper settings.
---
I have added Jack Steiner to the CC list. This was originally sent on Thu, 15 Dec 2011.
drivers/misc/sgi-xp/xpc_uv.c +2 -2
@@ -452,9 +452,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, if (msg->activate_gru_mq_desc_gpa ! part_uv->activate_gru_mq_desc_gpa) { -spin_lock_irqsave (&part_uv->flags_lock, irq_flags); +spin_lock (&part_uv->flags_lock); part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV ; -spin_unlock_irqrestore (&part_uv->flags_lock, irq_flags); +spin_unlock (&part_uv->flags_lock); part_uv->activate_gru_mq_desc_gpa msg->activate_gru_mq_desc_gpa; }
PATCH 1/3 pmcraid: remove unneeded check
In reply to Dan Carpenterrequest_size is zero here so this condition is always false. Also we already handled negative values some lines earlier so it's not negative for that reason as well.
It looks like this was introduced because we applied Dan Rosenberg's fix twice by mistake:b5b515445f4 "[SCSI] pmcraid: reject negative request size" 5f6279da376 "[SCSI] pmcraid: reject negative request size"
---
I have tweaked the changelog slightly. This was originally sent on Fri, 16 Dec 2011.
drivers/scsi/pmcraid.c +0 -3
@@ -3870,9 +3870,6 @@ static long pmcraid_ioctl_passthrough(pmcraid_err ("couldn't build passthrough ioadls\n" ); goto out_free_buffer; } - }else if (request_size <0 ) { - rc = -EINVAL ; - goto out_free_buffer; }/* If data is being written into the device, copy the data from user
PATCH 2/3 pmcraid: cpu_to_le32() => cpu_to_le64()
In reply to Dan CarpenterThe cpu_to_le32() truncates the address to 32 bits. All the other places that set .address use cpu_to_le64().
---
What about if dma_addr_t is 32 bits on a big endian system? Can that happen?
This patch was originally sent on Fri, 16 Dec 2011 and I sent a second reminder on Mon, Apr 30, 2012. I was silently ignored both times.
drivers/scsi/pmcraid.c +1 -1
@@ -1242,7 +1242,7 @@ static struct pmcraid_cmd *pmcraid_init_hcam ioadl[0 ].flags |=IOADL_FLAGS_READ_LAST ; ioadl[0 ].data_len =cpu_to_le32 (rcb_size); - ioadl[0 ].address =cpu_to_le32 (dma); + ioadl[0 ].address =cpu_to_le64 (dma); cmd->cmd_done = cmd_done;return cmd;
PATCH 3/3 pmcraid: find_first_zero_bit() takes bits not bytes
In reply to Dan CarpenterThe find_first_zero_bit() function takes the size in bits not bytes.
---
This patch was originally sent on Wed, 2 May 2012.
drivers/scsi/pmcraid.c +1 -1
@@ -5376,7 +5376,7 @@ static unsigned short pmcraid_get_minor(void) {int minor; - minor =find_first_zero_bit (pmcraid_minor,sizeof (pmcraid_minor)); + minor =find_first_zero_bit (pmcraid_minor,PMCRAID_MAX_ADAPTERS );__set_bit (minor, pmcraid_minor);return minor; }
PATCH 1/1 isci: add a couple __iomem annotations
In reply to Dan CarpenterThese are __iomem. Sparse complains if we don't have that.
drivers/scsi/isci/phy.c +149 70: warning:
incorrect type in initializer (different address spaces)
---
Sent on Wed, 18 Jan 2012.
drivers/scsi/isci/host.c +1 -1
@@ -1973,7 +1973,7 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) }for (phy_id =0 ; phy_id <SCI_MAX_PHYS ; phy_id++) { -struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_id]; +struct scu_afe_transceiver __iomem *xcvr = &afe->scu_afe_xcvr[phy_id];const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; int cable_length_long is_long_cable(phy_id, cable_selection_mask);
drivers/scsi/isci/phy.c +1 -1
@@ -169,7 +169,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, phy_cap.gen1_no_ssc =1 ;if (ihost->oem_parameters.controller.do_enable_ssc) {struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; -struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_idx]; +struct scu_afe_transceiver __iomem *xcvr = &afe->scu_afe_xcvr[phy_idx];struct isci_pci_info *pci_info =to_pci_info (ihost->pdev);bool en_sas = false;bool en_sata = false;
Re: [patch -resend] [SCSI] isci: add a couple __iomem annotations
Quoted 9 lines · Dan Carpenter
These are
__iomem. Sparse complains if we don't have that.
drivers/scsi/isci/phy.c+149 70: warning:
incorrect type in initializer (different address spaces)Signed-off-by Dan Carpenter <[email protected]>---
Sent on Wed, 18 Jan 2012.
Thanks for nudge, this fell off the radar. I'll get this into -next with the rest of the pending bits.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [SCSI] bfa: Implement LUN Masking feature using the SCSI Slave Callouts.
In reply to Dan CarpenterHi,
This bug is still present in linux-next.
regards,
dan carpenter
Quoted 30 lines · Dan Carpenter
Hello Krishna Gudipati,
This is a semi-automatic email about new static checker warnings.
The patch
5b7db7af522d: "[SCSI] bfa: Implement LUN Masking feature using the SCSI Slave Callouts." from Dec 20, 2011, leads to the following Smatch complaint:
drivers/scsi/bfa/bfad_im.c+962bfad_im_slave_alloc()
warn: variable dereferenced before check 'rport' (see line 959)
drivers/scsi/bfa/bfad_im.c957 struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 958 struct bfad_itnim_data_s *itnim_data = 959 (struct bfad_itnim_data_s *) rport->dd_data; ^^^^^^^New dereference.
960 struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa; 961 962 if (!rport || fc_remote_port_chkready(rport)) ^^^^^Old check.
963 return -ENXIO; 964regards,
dan carpenter
PATCH 1/1 NVMe: handle allocation failure in nvme_map_user_pages()
In reply to Dan CarpenterWe should return here and avoid a NULL dereference.
---
Originally sent on Fri, 20 Jan 2012.
drivers/block/nvme.c +2 -0
@@ -1037,6 +1037,8 @@ static struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, offset =offset_in_page (addr); count =DIV_ROUND_UP (offset + length,PAGE_SIZE ); pages =kcalloc (count,sizeof (*pages),GFP_KERNEL ); +if (!pages) +return ERR_PTR (-ENOMEM ); err =get_user_pages_fast (addr, count,1 , pages);if (err < count) {
PATCH 1/1 az6007: precedence bug in az6007_i2c_xfer()
In reply to Dan CarpenterThe intent here was to test that the flag was clear but the '!' has higher precedence than the '&'. I2C_M_RD is 0x1 so the current code is equivalent to "&& (!sgs[i].flags) ..."
---
I sent this originally on Wed, 25 Jan 2012 and Emil Goode sent the same fix on Thu, May 3, 2012.
drivers/media/dvb/dvb-usb/az6007.c +1 -1
@@ -711,7 +711,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], addr = msgs[i].addr <<1 ;if (((i +1 ) < num) && (msgs[i].len =1 ) - && (!msgs[i].flags &I2C_M_RD ) + && (!(msgs[i].flags &I2C_M_RD )) && (msgs[i +1 ].flags &I2C_M_RD ) && (msgs[i].addr = msgs[i +1 ].addr)) {/*
Re: [patch -resend] [media] az6007: precedence bug in az6007_i2c_xfer()
Em 27-06-2012 06:06, Dan Carpenter escreveu:
Quoted 15 lines
The intent here was to test that the flag was clear but the '!' has higher precedence than the '&'.
I2C_M_RDis0x1so the current code is equivalent to "&& (!sgs[i].flags) ..."Signed-off-by Dan Carpenter <[email protected]>---
I sent this originally on Wed, 25 Jan 2012 and Emil Goode sent the same fix on Thu, May 3, 2012.drivers/media/dvb/dvb-usb/az6007.c +0
-0
drivers/media/dvb/dvb-usb/az6007.c static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], · line 717
Quoted 8 lines
drivers/media/dvb/dvb-usb/az6007.c +1
-1@@ -711,7 +711,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], addr = msgs[i].addr <<1 ;if (((i +1 ) < num) && (msgs[i].len =1 ) - && (!msgs[i].flags &I2C_M_RD ) + && (!(msgs[i].flags &I2C_M_RD )) && (msgs[i +1 ].flags &I2C_M_RD ) && (msgs[i].addr = msgs[i +1 ].addr)) {/*
Dan,
Your logic is correct, however, I didn't apply this patch because it broke the driver.
I'll need to re-visit the driver when I have some time, in order to be able to apply this one, without breaking the driver. I'll likely need to change some other things on this routine.
(this has a low priority, as the driver is working properly the way it is).
So, I'm keeping your patch at patchwork, while I don't find some time for it.
Regards,
Mauro
Re: [patch -resend] [media] az6007: precedence bug in az6007_i2c_xfer()
Quoted 30 lines · Mauro Carvalho Chehab
Em 27-06-2012 06:06, Dan Carpenter escreveu:
Quoted 15 lines
The intent here was to test that the flag was clear but the '!' has higher precedence than the '&'.
I2C_M_RDis0x1so the current code is equivalent to "&& (!sgs[i].flags) ..."Signed-off-by Dan Carpenter <[email protected]>---
I sent this originally on Wed, 25 Jan 2012 and Emil Goode sent the same fix on Thu, May 3, 2012.drivers/media/dvb/dvb-usb/az6007.c +0
-0drivers/media/dvb/dvb-usb/az6007.c static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], · line 717
Quoted 8 lines
drivers/media/dvb/dvb-usb/az6007.c +1
-1@@ -711,7 +711,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], addr = msgs[i].addr <<1 ;if (((i +1 ) < num) && (msgs[i].len =1 ) - && (!msgs[i].flags &I2C_M_RD ) + && (!(msgs[i].flags &I2C_M_RD )) && (msgs[i +1 ].flags &I2C_M_RD ) && (msgs[i].addr = msgs[i +1 ].addr)) {/* Dan,
Your logic is correct, however, I didn't apply this patch because it broke the driver.
Quoted 7 lines
I'll need to re-visit the driver when I have some time, in order to be able to apply this one, without breaking the driver. I'll likely need to change some other things on this routine.
(this has a low priority, as the driver is working properly the way it is).
So, I'm keeping your patch at patchwork, while I don't find some time for it.
We could just put a comment next to the code and forget about it.
&& (!(msgs[i].flags & I2C_M_RD)) /* the fix needs testing. */
Sparse complains about this so it people are going to keep sending patches for it. It's not like you should be stuck doing all the work.
regards,
dan carpenter
PATCH v3 1/1 edac i5000, i5400: fix pointer math in i5000_get_mc_regs()
In reply to Dan Carpenter"pvt->ambase" is a u64 datatype. The intent here is to fill the first half in the first call to pci_read_config_dword() and the other half in the second. Unfortunately the pointer math is wrong so we set the wrong data.
---
v2: Redid it as with a union as Walter Harms suggested.
Fixed the same bug in i5400_edac.c as well.
v3: Make the struct __packed just in case.
I don't have this hardware, so please review carefully. But the original code obviously corrupts memory so my patch could hardly be worse...
This was originally sent on Mon, Mar 5, 2012. Btw, there are some Sparse errors in these files. The code looks buggy but I don't know what the intent was.
drivers/edac/i5000_edac.c:485:15: warning: right shift by bigger than source value drivers/edac/i5000_edac.c:580:23: warning: right shift by bigger than source value drivers/edac/i5400_edac.c:391:36: warning: right shift by bigger than source value drivers/edac/i5400_edac.c:401:37: warning: right shift by bigger than source value
drivers/edac/i5000_edac.c +9 -3
@@ -328,7 +328,13 @@ struct i5000_pvt {struct pci_dev *branch_1;/* 22.0 */ u16 tolm;/* top of low memory */ -u64 ambase;/* AMB BAR */ +union { +u64 ambase;/* AMB BAR */ +struct { +u32 ambase_bottom; +u32 ambase_top; + } u __packed; + };u16 mir0, mir1, mir2;
@@ -1131,9 +1137,9 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) pvt = mci->pvt_info;pci_read_config_dword (pvt->system_address,AMBASE , - (u32 *) & pvt->ambase); + &pvt->u.ambase_bottom);pci_read_config_dword (pvt->system_address,AMBASE +sizeof (u32), - ((u32 *) & pvt->ambase) +sizeof (u32)); + &pvt->u.ambase_top); maxdimmperch = pvt->maxdimmperch; maxch = pvt->maxch;
drivers/edac/i5400_edac.c +9 -3
@@ -327,7 +327,13 @@ struct i5400_pvt {struct pci_dev *branch_1;/* 22.0 */ u16 tolm;/* top of low memory */ -u64 ambase;/* AMB BAR */ +union { +u64 ambase;/* AMB BAR */ +struct { +u32 ambase_bottom; +u32 ambase_top; + } u __packed; + };u16 mir0, mir1;
@@ -1055,9 +1061,9 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) pvt = mci->pvt_info;pci_read_config_dword (pvt->system_address,AMBASE , - (u32 *) &pvt->ambase); + &pvt->u.ambase_bottom);pci_read_config_dword (pvt->system_address,AMBASE +sizeof (u32), - ((u32 *) &pvt->ambase) +sizeof (u32)); + &pvt->u.ambase_top); maxdimmperch = pvt->maxdimmperch; maxch = pvt->maxch;
Mauro Carvalho Chehab
AppliedRe: [patch v3 -resend] edac i5000, i5400: fix pointer math in i5000_get_mc_regs()
Em 27-06-2012 06:07, Dan Carpenter escreveu:
Quoted 4 lines
"
pvt->ambase" is a u64 datatype. The intent here is to fill the first half in the first call topci_read_config_dword()and the other half in the second. Unfortunately the pointer math is wrong so we set the wrong data.
Applied, thanks!
Mauro
Quoted 83 lines
Signed-off-by Dan Carpenter <[email protected]>---
v2: Redid it as with a union as Walter Harms suggested.
Fixed the same bug ini5400_edac.cas well.
v3: Make the struct__packedjust in case.I don't have this hardware, so please review carefully. But the original code obviously corrupts memory so my patch could hardly be worse...
This was originally sent on Mon, Mar 5, 2012. Btw, there are some Sparse errors in these files. The code looks buggy but I don't know what the intent was.
drivers/edac/i5000_edac.c:485:15: warning: right shift by bigger than source valuedrivers/edac/i5000_edac.c:580:23: warning: right shift by bigger than source valuedrivers/edac/i5400_edac.c:391:36: warning: right shift by bigger than source valuedrivers/edac/i5400_edac.c:401:37: warning: right shift by bigger than source valuedrivers/edac/i5000_edac.c +9
-3@@ -328,7 +328,13 @@ struct i5000_pvt {struct pci_dev *branch_1;/* 22.0 */ u16 tolm;/* top of low memory */ -u64 ambase;/* AMB BAR */ +union { +u64 ambase;/* AMB BAR */ +struct { +u32 ambase_bottom; +u32 ambase_top; + } u __packed; + };u16 mir0, mir1, mir2;@@ -1131,9 +1137,9 @@ static void i5000_get_mc_regs(struct mem_ctl_info *mci) pvt = mci->pvt_info;pci_read_config_dword (pvt->system_address,AMBASE , - (u32 *) & pvt->ambase); + &pvt->u.ambase_bottom);pci_read_config_dword (pvt->system_address,AMBASE +sizeof (u32), - ((u32 *) & pvt->ambase) +sizeof (u32)); + &pvt->u.ambase_top); maxdimmperch = pvt->maxdimmperch; maxch = pvt->maxch;drivers/edac/i5400_edac.c +9
-3@@ -327,7 +327,13 @@ struct i5400_pvt {struct pci_dev *branch_1;/* 22.0 */ u16 tolm;/* top of low memory */ -u64 ambase;/* AMB BAR */ +union { +u64 ambase;/* AMB BAR */ +struct { +u32 ambase_bottom; +u32 ambase_top; + } u __packed; + };u16 mir0, mir1;@@ -1055,9 +1061,9 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci) pvt = mci->pvt_info;pci_read_config_dword (pvt->system_address,AMBASE , - (u32 *) &pvt->ambase); + &pvt->u.ambase_bottom);pci_read_config_dword (pvt->system_address,AMBASE +sizeof (u32), - ((u32 *) &pvt->ambase) +sizeof (u32)); + &pvt->u.ambase_top); maxdimmperch = pvt->maxdimmperch; maxch = pvt->maxch;
PATCH 1/1 megaraid: cleanup type issue in mega_build_cmd()
In reply to Dan CarpenterOn 64 bit systems the current code sets 32 bits of "seg" and leaves the other 32 uninitialized. It doesn't matter since the variable is never used. But it's still messy and we should fix it.
---
Originally sent on Fri, 2 Mar 2012.
drivers/scsi/megaraid.c +2 -2
@@ -524,7 +524,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)mega_passthru *pthru;scb_t *scb;mbox_t *mbox; -long seg; +u32 seg;char islogical;int max_ldrv_num;int channel =0 ;
@@ -858,7 +858,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)/* Calculate Scatter-Gather info */ mbox->m_out.numsgelements =mega_build_sglist (adapter, scb, - (u32 *)&mbox->m_out.xferaddr, (u32 *)&seg); + (u32 *)&mbox->m_out.xferaddr, &seg);return scb;
Re: [patch -resend] [SCSI] megaraid: cleanup type issue in mega_build_cmd()
Quoted 31 lines · Dan Carpenter
On 64 bit systems the current code sets 32 bits of "seg" and leaves the other 32 uninitialized. It doesn't matter since the variable is never used. But it's still messy and we should fix it.
Signed-off-by Dan Carpenter <[email protected]>---
Originally sent on Fri, 2 Mar 2012.drivers/scsi/megaraid.c +2
-3@@ -524,7 +524,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy) mega_passthru *pthru; scb_t *scb; mbox_t *mbox; - long seg; + u32 seg; char islogical; int max_ldrv_num; int channel = 0;@@ -858,7 +858,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy) /* Calculate Scatter-Gather info */ mbox->m_out.numsgelements = mega_build_sglist(adapter, scb, - (u32 *)&mbox->m_out.xferaddr, (u32 *)&seg); + (u32 *)&mbox->m_out.xferaddr, &seg); return scb; --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/2 SCSI: advansys: use a subsystem error code
In reply to Dan CarpenterThis was supposed to be a subsystem specific error code. It makes static checkers complain because "warn_code" is unsigned short so it can't store negatives.
---
Originally sent on Tue, 20 Sep 2011.
drivers/scsi/advansys.c +1 -1
@@ -4724,7 +4724,7 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc) asc_dvc->overrun_dma =dma_map_single (board->dev, asc_dvc->overrun_buf,ASC_OVERRUN_BSIZE ,DMA_FROM_DEVICE );if (dma_mapping_error (board->dev, asc_dvc->overrun_dma)) { - warn_code = -ENOMEM ; + warn_code =UW_ERR ; goto err_dma_map; } phy_addr =cpu_to_le32 (asc_dvc->overrun_dma);
PATCH 2/2 iommu/amd: fix type bug in flush code
In reply to Dan Carpenterwrite_file_bool() modifies 32 bits of data, so "amd_iommu_unmap_flush" needs to be 32 bits as well or we'll corrupt memory. Fortunately it looks like the data is aligned with a gap after the declaration so this is harmless in production.
---
Originally sent on Fri, 2 Mar 2012. This is the other patch where I guess I was supposed to modify debugfs_create_bool() to take bool pointers.
drivers/iommu/amd_iommu_types.h +1 -1
@@ -652,7 +652,7 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap;* If true, the addresses will be flushed on unmap time, not when * they are reused */ -extern bool amd_iommu_unmap_flush; +extern u32 amd_iommu_unmap_flush;/* Smallest number of PASIDs supported by any IOMMU in the system */ extern u32 amd_iommu_max_pasids;
drivers/iommu/amd_iommu.c +1 -1
@@ -451,7 +451,7 @@ static void amd_iommu_stats_init(void)return ; de_fflush =debugfs_create_bool ("fullflush" ,0444 , stats_dir, - (u32 *)&amd_iommu_unmap_flush); + &amd_iommu_unmap_flush);amd_iommu_stats_add (&compl_wait);amd_iommu_stats_add (&cnt_map_single);
drivers/iommu/amd_iommu_init.c +1 -1
@@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we haveto handle */ LIST_HEAD (amd_iommu_unity_map);/* a list of required unity mappings we find in ACPI */ -bool amd_iommu_unmap_flush;/* if true, flush on every unmap */ +u32 amd_iommu_unmap_flush;/* if true, flush on every unmap */ LIST_HEAD (amd_iommu_list);/* list of all AMD IOMMUs in the system */
PATCH 1/1 isci: make function declaration match implementation
In reply to Dan CarpenterSparse complains that we redeclare this with a different type, because in the .c file we use an enum and in the .h file we declare the parameter as a u32. Probably it's best to use an enum in both places.
---
I originally sent this on Tue, 27 Mar 2012, and Emil Goode sent the same patch on Fri, May 4, 2012. Both were silently ignored.
drivers/scsi/isci/remote_node_context.h +1 -1
@@ -212,7 +212,7 @@ enum sci_status sci_remote_node_context_destruct(struct sci_remote_node_contextscics_sds_remote_node_context_callback callback, void *callback_parameter);enum sci_status sci_remote_node_context_suspend (struct sci_remote_node_context *sci_rnc, -u32 suspend_type, +enum sci_remote_node_suspension_reasons reason,u32 suspension_code); enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *sci_rnc, scics_sds_remote_node_context_callback cb_fn,
PATCH 1/1 drm/i915/bios: cleanup return type of intel_parse_bios()
In reply to Dan CarpenterThese are unintuitive. These are type bool and return -1 casted to true on failure. Let's just make it return an int. The callers don't care, but let's change this as a cleanup.
---
Originally sent on Wed, Mar 28, 2012. This one is prossibly my fault. I assumed these would be in the same tree, but apparently I should have broken them out. Daniel acked the patch and told me that if I wanted to I could break it up and he could merge part (or all of it?). I have no problem with redoing patches but I understood that to mean it was going to go through a someone else's tree with his Acked-by. If you give me an option, of course I'm going to pick the laziest one. That is my firm promise and commitment.
drivers/gpu/drm/gma500/intel_bios.h +1 -1
@@ -431,7 +431,7 @@ struct bdb_driver_features {u8 custom_vbt_version; } __attribute__((packed)); -extern bool psb_intel_init_bios (struct drm_device *dev); +extern int psb_intel_init_bios (struct drm_device *dev);extern void psb_intel_destroy_bios (struct drm_device *dev);/*
drivers/gpu/drm/gma500/intel_bios.c +1 -1
@@ -427,7 +427,7 @@ parse_device_mapping(struct drm_psb_private *dev_priv,* * Returns 0 on success, nonzero on failure. */ -bool psb_intel_init_bios (struct drm_device *dev) +int psb_intel_init_bios (struct drm_device *dev) {struct drm_psb_private *dev_priv = dev->dev_private;struct pci_dev *pdev = dev->pdev;
drivers/gpu/drm/i915/intel_bios.h +1 -1
@@ -476,7 +476,7 @@ struct bdb_edp { } __attribute__ ((packed));void intel_setup_bios (struct drm_device *dev); -bool intel_parse_bios (struct drm_device *dev); +int intel_parse_bios (struct drm_device *dev);/* * Driver<->VBIOS interaction occurs through scratch bits in
drivers/gpu/drm/i915/intel_bios.c +1 -1
@@ -692,7 +692,7 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {* * Returns 0 on success, nonzero on failure. */ -bool +int intel_parse_bios (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
PATCH 1/1 leds-lp5523: BUG() in error handling in probe()
In reply to Dan CarpenterInside the error handling in lp5523_init_led(), there is a place that calls to led_classdev_unregister(). When we unregister the LED drivers, it tries to set the brightness to OFF. In this driver setting the brightness is done through a work queue and the work queue hasn't been initialized yet.
The result is that we trigger a WARN_ON() in the __queue_work().
The fix is to move the INIT_WORK() in front of the call to lp5523_init_led().
Matt Renzelmann found this using a bug finding tool.
---
I don't have this hardware, so I can't test it. I originally sent this on Fri, 13 Apr 2012, and that was before Bryan Wu took on the LED subsystem. Also when I sent it, the WARN_ON() in __queue_work() was a BUG_ON() so I've updated the commit message.
drivers/leds/leds-lp5523.c +3 -3
@@ -943,6 +943,9 @@ static int __devinit lp5523_probe(struct i2c_client *client,if (pdata->led_config[i].led_current =0 )continue ; +INIT_WORK (&chip->leds[led].brightness_work, + lp5523_led_brightness_work); + ret =lp5523_init_led (&chip->leds[led], &client->dev, i, pdata);if (ret) {dev_err (&client->dev,"error initializing leds\n" );
@@ -956,9 +959,6 @@ static int __devinit lp5523_probe(struct i2c_client *client,LP5523_REG_LED_CURRENT_BASE + chip->leds[led].chan_nr, chip->leds[led].led_current); -INIT_WORK (&(chip->leds[led].brightness_work), - lp5523_led_brightness_work); - led++; }
Re: [patch -resend] leds-lp5523: BUG() in error handling in probe()
Quoted 11 lines · Dan Carpenter
Inside the error handling in
lp5523_init_led(), there is a place that calls toled_classdev_unregister(). When we unregister the LED drivers, it tries to set the brightness to OFF. In this driver setting the brightness is done through a work queue and the work queue hasn't been initialized yet.The result is that we trigger a
WARN_ON()in the__queue_work().The fix is to move the
INIT_WORK()in front of the call tolp5523_init_led().
Thanks for resending this, I applied this in my for-next branch.
Quoted 1 line
Matt Renzelmann found this using a bug finding tool.
Just be curious, what's kind of the tool here?
-Bryan
Quoted 33 lines
Reported-by Matt Renzelmann <[email protected]>Signed-off-by Dan Carpenter <[email protected]>---
I don't have this hardware, so I can't test it. I originally sent this on Fri, 13 Apr 2012, and that was before Bryan Wu took on the LED subsystem. Also when I sent it, theWARN_ON()in__queue_work()was aBUG_ON()so I've updated the commit message.drivers/leds/leds-lp5523.c +3
-3@@ -943,6 +943,9 @@ static int __devinit lp5523_probe(struct i2c_client *client, if (pdata->led_config[i].led_current = 0) continue; + INIT_WORK(&chip->leds[led].brightness_work, + lp5523_led_brightness_work); + ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata); if (ret) { dev_err(&client->dev, "error initializing leds\n");@@ -956,9 +959,6 @@ static int __devinit lp5523_probe(struct i2c_client *client, LP5523_REG_LED_CURRENT_BASE + chip->leds[led].chan_nr, chip->leds[led].led_current); - INIT_WORK(&(chip->leds[led].brightness_work), - lp5523_led_brightness_work); - led++; }
Signature · 8 lines
Bryan Wu <[email protected]> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch -resend] leds-lp5523: BUG() in error handling in probe()
Quoted 13 lines · Bryan Wu
Quoted 11 lines · Dan Carpenter
Inside the error handling in
lp5523_init_led(), there is a place that calls toled_classdev_unregister(). When we unregister the LED drivers, it tries to set the brightness to OFF. In this driver setting the brightness is done through a work queue and the work queue hasn't been initialized yet.The result is that we trigger a
WARN_ON()in the__queue_work().The fix is to move the
INIT_WORK()in front of the call tolp5523_init_led().
Quoted 6 lines
Thanks for resending this, I applied this in my for-next branch.
Quoted 1 line
Matt Renzelmann found this using a bug finding tool.
Just be curious, what's kind of the tool here?
Sorry I should have CC'd Matt on this. I think it's something he is working on at the University of Wisconsin. That's all I know.
regards,
dan carpenter
Quoted 29 lines
-Bryan
Quoted 27 lines
Reported-by Matt Renzelmann <[email protected]>Signed-off-by Dan Carpenter <[email protected]>---
I don't have this hardware, so I can't test it. I originally sent this on Fri, 13 Apr 2012, and that was before Bryan Wu took on the LED subsystem. Also when I sent it, theWARN_ON()in__queue_work()was aBUG_ON()so I've updated the commit message.drivers/leds/leds-lp5523.c +3
-0@@ -943,6 +943,9 @@ static int __devinit lp5523_probe(struct i2c_client *client, if (pdata->led_config[i].led_current = 0) continue; + INIT_WORK(&chip->leds[led].brightness_work, + lp5523_led_brightness_work); + ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata); if (ret) { dev_err(&client->dev, "error initializing leds\n");@@ -956,9 +959,6 @@ static int __devinit lp5523_probe(struct i2c_client *client, LP5523_REG_LED_CURRENT_BASE + chip->leds[led].chan_nr, chip->leds[led].led_current);
Quoted 14 lines
Quoted 6 lines
drivers/leds/leds-lp5523.c +0
-3- INIT_WORK(&(chip->leds[led].brightness_work), - lp5523_led_brightness_work); - led++; }Signature · 4 lines
Bryan Wu <[email protected]> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [patch -resend] leds-lp5523: BUG() in error handling in probe()
Quoted 11 lines
Quoted 3 lines
Just be curious, what's kind of the tool here?
Sorry I should have CC'd Matt on this. I think it's something he is working on at the University of Wisconsin. That's all I know.
regards,
dan carpenterQuoted 1 line
-Bryan
Dan is correct. We've submitted the project for publication but whether it will be accepted is another question. If it's published I'd be happy to provide a reference.
In a nutshell, the tool we've developed uses symbolic execution to reduce the need for device hardware for driver testing and execute real Linux drivers in the kernel. It provides symbolic data in place of hardware input. The tool allows us to run real drivers even if the hardware is unavailable. It can't find all bugs, but it can find many that could manifest in real conditions, e.g. null pointer dereferences, incorrect kernel API usage, some "panics" and "BUG" calls, etc.
I'll try to remember to write back when it's published, at which point I'd be happy to provide more detail.
Thanks for the interest,
Matt
PATCH 1/1 Input: ff-memless - fix a couple min_t() casts
In reply to Dan Carpenterenvelope->attack_level is a u16 type. We're trying to clamp it here so it's between 0 and 0x7fff. Unfortunately, the cast to __s16 turns all the values larger than 0x7fff into negative numbers and min_t() thinks they are less than 0x7fff. envelope_level is an int so now we've got negative values stored there.
---
Originally sent on Mon, 26 Sep 2011. I have added Anssi Hannula to the CC list.
drivers/input/ff-memless.c +2 -2
@@ -176,7 +176,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, value, envelope->attack_level); time_from_level =jiffies_to_msecs (now - state->play_at); time_of_envelope = envelope->attack_length; - envelope_level =min_t (__s16, envelope->attack_level,0x7fff ); + envelope_level =min_t (u16, envelope->attack_level,0x7fff ); } else if (envelope->fade_length && effect->replay.length && time_after(now,
@@ -184,7 +184,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, time_before(now, state->stop_at)) { time_from_level =jiffies_to_msecs (state->stop_at - now); time_of_envelope = envelope->fade_length; - envelope_level =min_t (__s16, envelope->fade_level,0x7fff ); + envelope_level =min_t (u16, envelope->fade_level,0x7fff ); } else return value;
Re: [patch -resend] Input: ff-memless - fix a couple min_t() casts
Quoted 7 lines · Dan Carpenter
envelope->attack_levelis a u16 type. We're trying to clamp it here so it's between 0 and0x7fff. Unfortunately, the cast to__s16turns all the values larger than0x7fffinto negative numbers andmin_t()thinks they are less than0x7fff.envelope_levelis an int so now we've got negative values stored there.Signed-off-by Dan Carpenter <[email protected]>
Applied, thank you Dan.
Quoted 26 lines
---
Originally sent on Mon, 26 Sep 2011. I have added Anssi Hannula to the CC list.drivers/input/ff-memless.c +2
-2@@ -176,7 +176,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, value, envelope->attack_level); time_from_level =jiffies_to_msecs (now - state->play_at); time_of_envelope = envelope->attack_length; - envelope_level =min_t (__s16, envelope->attack_level,0x7fff ); + envelope_level =min_t (u16, envelope->attack_level,0x7fff ); } else if (envelope->fade_length && effect->replay.length && time_after(now,@@ -184,7 +184,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, time_before(now, state->stop_at)) { time_from_level =jiffies_to_msecs (state->stop_at - now); time_of_envelope = envelope->fade_length; - envelope_level =min_t (__s16, envelope->fade_level,0x7fff ); + envelope_level =min_t (u16, envelope->fade_level,0x7fff ); } else return value;
Signature · 1 line
Dmitry
PATCH 1/1 tlb_uv: remove some dead code in parse_tunables_write()
In reply to Dan CarpenterThis code isn't reachable anymore after f073cc8f39 "x86, UV: Clean up uv_tlb.c" because we will always hit a continue statement. This causes a Smatch message:
arch/x86/platform/uv/tlb_uv.c:1531 parse_tunables_write()
info: ignoring unreachable code.
---
I have cleaned up the commit message. This was originally sent on Sun, 7 Aug 2011.
arch/x86/platform/uv/tlb_uv.c +0 -2
@@ -1528,8 +1528,6 @@ static int parse_tunables_write(struct bau_control *bcp, char *instr, *tunables[cnt].tunp = val;continue ; } -if (q = p) -break ; }return 0 ; }