@@ -312,7 +312,7 @@ static const char *sg_rq_st_str(enum sg_rq_state rq_st, bool long_str);
pr_info("sg: sdp or sfp NULL, " fmt, ##a); \
} while (0)
#else
-#define SG_LOG(depth, sfp, fmt, a...) { }
+#define SG_LOG(depth, sfp, fmt, a...) do { } while (0)
#endif /* end of CONFIG_SCSI_LOGGING && SG_DEBUG conditional */
@@ -522,11 +522,9 @@ sg_release(struct inode *inode, struct file *filp)
kref_put(&sfp->f_ref, sg_remove_sfp);
/*
- * Possibly many open()s waiting on exlude clearing, start many;
+ * Possibly many open()s waiting on exclude clearing, start many;
* only open(O_EXCL)'s wait when open_cnt<2 and only start one.
*/
- /* possibly many open()s waiting on exlude clearing, start many;
- * only open(O_EXCL)s wait on 0==open_cnt so only start one */
if (test_and_clear_bit(SG_FDEV_EXCLUDE, sdp->fdev_bm))
wake_up_interruptible_all(&sdp->open_wait);
else if (o_count < 2)
@@ -1584,7 +1582,7 @@ sg_ctl_req_tbl(struct sg_fd *sfp, void __user *p)
SZ_SG_REQ_INFO * SG_MAX_QUEUE);
#endif
kfree(rinfop);
- return result;
+ return result > 0 ? -EFAULT : result; /* treat short copy as error */
}
static int
@@ -2711,9 +2709,9 @@ sg_finish_scsi_blk_rq(struct sg_request *srp)
static int
sg_mk_sgat(struct sg_request *srp, struct sg_fd *sfp, int minlen)
{
- int j, k, rem_sz, align_sz;
+ int j, k, rem_sz, align_sz, order, o_order;
int mx_sgat_elems = sfp->parentdp->max_sgat_elems;
- unsigned int elem_sz, order, o_order;
+ unsigned int elem_sz;
const size_t ptr_sz = sizeof(struct page *);
gfp_t mask_ap = GFP_ATOMIC | __GFP_COMP | __GFP_NOWARN | __GFP_ZERO;
gfp_t mask_kz = GFP_ATOMIC | __GFP_NOWARN;
The 5.12/scsi-staging branch current has patches 1 through 26 out of 45 presented, applied around version 13 (currently at version 15 about to be 16). Due to bug fixes in the author's patchset, there is a divergence in the drivers/scsi/sg.c source file. This patch brings them back into sync. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> --- This patch is designed to be applied to the 5.12/scsi-staging branch or the branch containing patches 1 through 26 taken from patchset v13. drivers/scsi/sg.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)