Re: [PATCH] qla2xxx: Don't memset buffer unless debug level is enabled

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

 





On Thu, 1 Dec 2011, James Bottomley wrote:

On Thu, 2011-12-01 at 13:01 -0500, Chad Dupuis wrote:

On Thu, 1 Dec 2011, Nicholas A. Bellinger wrote:

On Thu, 2011-12-01 at 09:12 +0100, Sebastian Andrzej Siewior wrote:
On 11/30/2011 11:03 PM, Nicholas A. Bellinger wrote:
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 07372de..cc32ec8 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1676,11 +1676,11 @@ ql_dbg(uint32_t level, scsi_qla_host_t *vha, int32_t id, char *msg, ...) {
    uint32_t len;
    struct pci_dev *pdev = NULL;

-   memset(pbuf, 0, QL_DBG_BUF_LEN);
-
    va_start(ap, msg);

    if ((level&  ql2xextended_error_logging) == level) {
+           memset(pbuf, 0, QL_DBG_BUF_LEN);
+

512bytes on the stack is brave.

...

 Anyway, why do you memset the whole
buffer? As far the string processing is concerned, setting the first
byte to zero is enough.


After converting qla_target.c in a few hundred locations to use
qla_dbg() my wrists are still hurting, so you can imagine I'm not real
eager to look into this code.  ;)

Anyways, memset of the whole buffer is overkill.  Since sprintf() is
being used for qla_dbg.c cases, even the 1 byte memset is unnecessary.

I do want to note that there is a patch posted already that removes the
memset as well:
http://marc.info/?l=linux-scsi&m=132163664809856&w=2.

So since that one came from you as part of a series, I was originally
planning to merge it before you acked this one, which basically makes
this one redundant (and conflicting), doesn't it?  Which patch did you
want me to take, since I can't take both?

Apologies for that. Please take the first one that was part of the series.


James



This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux