lkml.org 
[lkml]   [2011]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH-v3 13/14] iscsi-target: Add misc utility and debug logic
    From
    2011/5/12 Nicholas A. Bellinger <nab@linux-iscsi.org>:
    > From: Nicholas Bellinger <nab@linux-iscsi.org>
    >
    > This file adds iscsi_target_util.[c,h] code containing a number
    > of miscellaneous utility functions for iscsi_target_mod.
    >
    > It also contains iscsi_debug.h macros for CONFIG_ISCSI_TARGET_DEBUG
    >
    > Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>

    <snip>

    > diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
    > new file mode 100644
    > index 0000000..af1c5c44
    > --- /dev/null
    > +++ b/drivers/target/iscsi/iscsi_target_util.c

    <snip>

    > +
    > +struct iscsi_r2t *iscsit_get_r2t_for_eos(
    > +       struct iscsi_cmd *cmd,
    > +       u32 offset,
    > +       u32 length)
    > +{
    > +       struct iscsi_r2t *r2t;
    > +
    > +       spin_lock_bh(&cmd->r2t_lock);
    > +       list_for_each_entry(r2t, &cmd->cmd_r2t_list, r2t_list) {
    > +               if ((r2t->offset <= offset) &&
    > +                   (r2t->offset + r2t->xfer_len) >= (offset + length))
    > +                       break;
    > +       }
    > +       spin_unlock_bh(&cmd->r2t_lock);
    > +
    > +       if (!r2t) {
    > +               printk(KERN_ERR "Unable to locate R2T for Offset: %u, Length:"
    > +                               " %u\n", offset, length);
    > +               return NULL;
    > +       }
    > +
    > +       return r2t;
    > +}
    > +

    Nicholas,

    This lookup pattern (repeated several times throughout the patch)
    looks seriously flawed to me as r2t will never be NULL.

    Arne
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-05-13 21:33    [W:0.022 / U:29.792 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site