* [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc
@ 2020-10-26 16:06 Arnd Bergmann
2020-10-26 16:06 ` [PATCH 2/2] libfc: work around Warray-bounds warning Arnd Bergmann
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Arnd Bergmann @ 2020-10-26 16:06 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke
Cc: Arnd Bergmann, Saurav Kashyap, Javed Hasan,
GR-QLogic-Storage-Upstream, Gustavo A. R. Silva, Lee Jones,
linux-scsi, linux-kernel, target-devel
From: Arnd Bergmann <arnd@arndb.de>
Most of this file is only used inside of libfc, so move
it to where it is actually used, with only fc_fill_fc_hdr()
left inside of the header.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/bnx2fc/bnx2fc.h | 1 -
drivers/scsi/libfc/fc_elsct.c | 2 +-
.../scsi => drivers/scsi/libfc}/fc_encode.h | 30 +------------------
drivers/scsi/libfc/fc_exch.c | 1 -
drivers/scsi/libfc/fc_fcp.c | 2 +-
drivers/scsi/libfc/fc_libfc.c | 2 +-
drivers/scsi/libfc/fc_lport.c | 2 +-
drivers/scsi/libfc/fc_rport.c | 2 +-
drivers/scsi/qedf/qedf.h | 1 -
drivers/target/tcm_fc/tfc_cmd.c | 1 -
drivers/target/tcm_fc/tfc_io.c | 1 -
include/scsi/fc_frame.h | 30 +++++++++++++++++++
12 files changed, 36 insertions(+), 39 deletions(-)
rename {include/scsi => drivers/scsi/libfc}/fc_encode.h (96%)
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index b6e8ed757252..b4cea8b06ea1 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -51,7 +51,6 @@
#include <scsi/scsi_tcq.h>
#include <scsi/libfc.h>
#include <scsi/libfcoe.h>
-#include <scsi/fc_encode.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/fc/fc_fip.h>
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
index 13a2e7c33cb1..8d3006edbe12 100644
--- a/drivers/scsi/libfc/fc_elsct.c
+++ b/drivers/scsi/libfc/fc_elsct.c
@@ -15,7 +15,7 @@
#include <scsi/fc/fc_ns.h>
#include <scsi/fc/fc_els.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
+#include "fc_encode.h"
#include "fc_libfc.h"
/**
diff --git a/include/scsi/fc_encode.h b/drivers/scsi/libfc/fc_encode.h
similarity index 96%
rename from include/scsi/fc_encode.h
rename to drivers/scsi/libfc/fc_encode.h
index c6660205d73f..18203cae04b2 100644
--- a/include/scsi/fc_encode.h
+++ b/drivers/scsi/libfc/fc_encode.h
@@ -9,6 +9,7 @@
#define _FC_ENCODE_H_
#include <asm/unaligned.h>
#include <linux/utsname.h>
+#include <scsi/fc/fc_ms.h>
/*
* F_CTL values for simple requests and responses.
@@ -39,35 +40,6 @@ struct fc_ct_req {
} payload;
};
-static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
- enum fc_rctl r_ctl,
- u32 did, u32 sid, enum fc_fh_type type,
- u32 f_ctl, u32 parm_offset)
-{
- WARN_ON(r_ctl == 0);
- fh->fh_r_ctl = r_ctl;
- hton24(fh->fh_d_id, did);
- hton24(fh->fh_s_id, sid);
- fh->fh_type = type;
- hton24(fh->fh_f_ctl, f_ctl);
- fh->fh_cs_ctl = 0;
- fh->fh_df_ctl = 0;
- fh->fh_parm_offset = htonl(parm_offset);
-}
-
-/**
- * fill FC header fields in specified fc_frame
- */
-static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
- u32 did, u32 sid, enum fc_fh_type type,
- u32 f_ctl, u32 parm_offset)
-{
- struct fc_frame_header *fh;
-
- fh = fc_frame_header_get(fp);
- __fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
-}
-
/**
* fc_adisc_fill() - Fill in adisc request frame
* @lport: local port.
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 851335f09221..d71afae6191c 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -20,7 +20,6 @@
#include <scsi/fc/fc_fc2.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
#include "fc_libfc.h"
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 7cfeb6886237..b43b5f62ee3e 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -26,8 +26,8 @@
#include <scsi/fc/fc_fc2.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
+#include "fc_encode.h"
#include "fc_libfc.h"
static struct kmem_cache *scsi_pkt_cachep;
diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c
index 19c4ab4e0f4d..0e6a1355d020 100644
--- a/drivers/scsi/libfc/fc_libfc.c
+++ b/drivers/scsi/libfc/fc_libfc.c
@@ -12,8 +12,8 @@
#include <linux/module.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
+#include "fc_encode.h"
#include "fc_libfc.h"
MODULE_AUTHOR("Open-FCoE.org");
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 6557fda85c5c..22826544da7e 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -84,9 +84,9 @@
#include <scsi/fc/fc_gs.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
#include <linux/scatterlist.h>
+#include "fc_encode.h"
#include "fc_libfc.h"
/* Fabric IDs to use for point-to-point mode, chosen on whims. */
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index a60b228d13f1..56003208d2e7 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -58,8 +58,8 @@
#include <asm/unaligned.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
+#include "fc_encode.h"
#include "fc_libfc.h"
static struct workqueue_struct *rport_event_queue;
diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
index 0e2cbb164eeb..88a592d09433 100644
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -11,7 +11,6 @@
#include <scsi/fc/fc_fip.h>
#include <scsi/fc/fc_fc2.h>
#include <scsi/scsi_tcq.h>
-#include <scsi/fc_encode.h>
#include <linux/version.h>
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index a7ed56602c6c..9c8c38a549c6 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -19,7 +19,6 @@
#include <asm/unaligned.h>
#include <scsi/scsi_tcq.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c
index 6a38ff936389..bbe2e29612fa 100644
--- a/drivers/target/tcm_fc/tfc_io.c
+++ b/drivers/target/tcm_fc/tfc_io.c
@@ -28,7 +28,6 @@
#include <linux/ratelimit.h>
#include <asm/unaligned.h>
#include <scsi/libfc.h>
-#include <scsi/fc_encode.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 41df2ba9dbaa..d544dc5057fc 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -246,4 +246,34 @@ static inline bool fc_frame_is_cmd(const struct fc_frame *fp)
*/
void fc_frame_leak_check(void);
+static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
+ enum fc_rctl r_ctl,
+ u32 did, u32 sid, enum fc_fh_type type,
+ u32 f_ctl, u32 parm_offset)
+{
+ WARN_ON(r_ctl == 0);
+ fh->fh_r_ctl = r_ctl;
+ hton24(fh->fh_d_id, did);
+ hton24(fh->fh_s_id, sid);
+ fh->fh_type = type;
+ hton24(fh->fh_f_ctl, f_ctl);
+ fh->fh_cs_ctl = 0;
+ fh->fh_df_ctl = 0;
+ fh->fh_parm_offset = htonl(parm_offset);
+}
+
+/**
+ * fill FC header fields in specified fc_frame
+ */
+static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
+ u32 did, u32 sid, enum fc_fh_type type,
+ u32 f_ctl, u32 parm_offset)
+{
+ struct fc_frame_header *fh;
+
+ fh = fc_frame_header_get(fp);
+ __fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
+}
+
+
#endif /* _FC_FRAME_H_ */
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] libfc: work around Warray-bounds warning
2020-10-26 16:06 [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc Arnd Bergmann
@ 2020-10-26 16:06 ` Arnd Bergmann
2020-10-27 2:39 ` [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2020-10-26 16:06 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen
Cc: Arnd Bergmann, linux-scsi, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building libfc with gcc -Warray-bounds identifies a number of
cases in one file where a strncpy() is performed into a single-byte
character array:
In file included from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:59,
from include/linux/debugobjects.h:6,
from include/linux/timer.h:8,
from include/scsi/libfc.h:11,
from drivers/scsi/libfc/fc_elsct.c:17:
In function 'strncpy',
inlined from 'fc_ct_ms_fill.constprop' at drivers/scsi/libfc/fc_encode.h:235:3:
include/linux/string.h:290:30: warning: '__builtin_strncpy' offset [56, 135] from the object at 'pp' is out of the bounds of referenced subobject 'value' with type '__u8[1]' {aka 'unsigned char[1]'} at offset 56 [-Warray-bounds]
290 | #define __underlying_strncpy __builtin_strncpy
| ^
include/linux/string.h:300:9: note: in expansion of macro '__underlying_strncpy'
300 | return __underlying_strncpy(p, q, size);
| ^~~~~~~~~~~~~~~~~~~~
This is not a bug because the 1-byte array is used as an odd way
to express a variable-length data field here. I tried to convert
it to a flexible-array member, but in the end could not figure out
why the sizeof(struct fc_fdmi_???) are used the way they are, and
how to properly convert those.
Work around this instead by abstracting the string copy
in a slightly higher-level function fc_ct_hdr_fill() helper
that strscpy() and memset() to achieve the same result as
strncpy() but does not require a zero-terminated input
and does not get checked for the array overflow because
gcc (so far) does not understand the behavior of strscpy().
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/libfc/fc_encode.h | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/libfc/fc_encode.h b/drivers/scsi/libfc/fc_encode.h
index 18203cae04b2..602c97a651bc 100644
--- a/drivers/scsi/libfc/fc_encode.h
+++ b/drivers/scsi/libfc/fc_encode.h
@@ -163,6 +163,14 @@ static inline int fc_ct_ns_fill(struct fc_lport *lport,
return 0;
}
+static inline void fc_ct_ms_fill_attr(struct fc_fdmi_attr_entry *entry,
+ const char *in, size_t len)
+{
+ int copied = strscpy(entry->value, in, len);
+ if (copied > 0)
+ memset(entry->value, copied, len - copied);
+}
+
/**
* fc_ct_ms_fill() - Fill in a mgmt service request frame
* @lport: local port.
@@ -232,7 +240,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_MANUFACTURER,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_manufacturer(lport->host),
FC_FDMI_HBA_ATTR_MANUFACTURER_LEN);
@@ -244,7 +252,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_SERIALNUMBER,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_serial_number(lport->host),
FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN);
@@ -256,7 +264,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_MODEL,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_model(lport->host),
FC_FDMI_HBA_ATTR_MODEL_LEN);
@@ -268,7 +276,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_MODELDESCRIPTION,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_model_description(lport->host),
FC_FDMI_HBA_ATTR_MODELDESCR_LEN);
@@ -280,7 +288,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_HARDWAREVERSION,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_hardware_version(lport->host),
FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN);
@@ -292,7 +300,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_DRIVERVERSION,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_driver_version(lport->host),
FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN);
@@ -304,7 +312,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_OPTIONROMVERSION,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_optionrom_version(lport->host),
FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN);
@@ -316,7 +324,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
put_unaligned_be16(FC_FDMI_HBA_ATTR_FIRMWAREVERSION,
&entry->type);
put_unaligned_be16(len, &entry->len);
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_firmware_version(lport->host),
FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN);
@@ -411,7 +419,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
&entry->type);
put_unaligned_be16(len, &entry->len);
/* Use the sysfs device name */
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
dev_name(&lport->host->shost_gendev),
strnlen(dev_name(&lport->host->shost_gendev),
FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
@@ -425,12 +433,12 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,
&entry->type);
put_unaligned_be16(len, &entry->len);
if (strlen(fc_host_system_hostname(lport->host)))
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
fc_host_system_hostname(lport->host),
strnlen(fc_host_system_hostname(lport->host),
FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
else
- strncpy((char *)&entry->value,
+ fc_ct_ms_fill_attr(entry,
init_utsname()->nodename,
FC_FDMI_PORT_ATTR_HOSTNAME_LEN);
break;
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc
2020-10-26 16:06 [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc Arnd Bergmann
2020-10-26 16:06 ` [PATCH 2/2] libfc: work around Warray-bounds warning Arnd Bergmann
@ 2020-10-27 2:39 ` kernel test robot
2020-10-30 1:52 ` Martin K. Petersen
2020-11-05 4:21 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-10-27 2:39 UTC (permalink / raw)
To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke
Cc: kbuild-all, Arnd Bergmann, Saurav Kashyap, Javed Hasan,
GR-QLogic-Storage-Upstream, Gustavo A. R. Silva, Lee Jones,
linux-scsi
[-- Attachment #1: Type: text/plain, Size: 11237 bytes --]
Hi Arnd,
I love your patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next soc/for-next v5.10-rc1 next-20201026]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/libfc-move-scsi-fc_encode-h-to-libfc/20201027-000828
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: riscv-randconfig-r033-20201026 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/fc5c97b36d0d6d4adba894820c9a412f0467438e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arnd-Bergmann/libfc-move-scsi-fc_encode-h-to-libfc/20201027-000828
git checkout fc5c97b36d0d6d4adba894820c9a412f0467438e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/scsi/libfc/fc_elsct.c:18:
In function 'fc_ct_ns_fill',
inlined from 'fc_ct_fill' at drivers/scsi/libfc/fc_encode.h:483:8,
inlined from 'fc_elsct_send' at drivers/scsi/libfc/fc_elsct.c:47:8:
>> drivers/scsi/libfc/fc_encode.h:153:3: warning: 'strncpy' output may be truncated copying between 0 and 255 bytes from a string of length 255 [-Wstringop-truncation]
153 | strncpy(ct->payload.snn.fr_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154 | fc_host_symbolic_name(lport->host), len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/libfc/fc_encode.h:143:3: warning: 'strncpy' output may be truncated copying between 0 and 255 bytes from a string of length 255 [-Wstringop-truncation]
143 | strncpy(ct->payload.spn.fr_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144 | fc_host_symbolic_name(lport->host), len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +153 drivers/scsi/libfc/fc_encode.h
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 81
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 82 /**
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 83 * fc_ct_ns_fill() - Fill in a name service request frame
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 84 * @lport: local port.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 85 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 86 * @fp: frame to contain payload.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 87 * @op: CT opcode.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 88 * @r_ctl: pointer to FC header R_CTL.
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 89 * @fh_type: pointer to FC-4 type.
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 90 */
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 91 static inline int fc_ct_ns_fill(struct fc_lport *lport,
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 92 u32 fc_id, struct fc_frame *fp,
a46f327aa5caf2 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 93 unsigned int op, enum fc_rctl *r_ctl,
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 94 enum fc_fh_type *fh_type)
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 95 {
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 96 struct fc_ct_req *ct;
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 97 size_t len;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 98
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 99 switch (op) {
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 100 case FC_NS_GPN_FT:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 101 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 102 FC_FST_DIR, FC_NS_SUBTYPE);
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 103 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 104 break;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 105
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 106 case FC_NS_GPN_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 107 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 108 FC_FST_DIR, FC_NS_SUBTYPE);
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 109 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 110 hton24(ct->payload.fid.fp_fid, fc_id);
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 111 break;
2ab7e1ecb81ce3 include/scsi/fc_encode.h Joe Eykholt 2009-08-25 112
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 113 case FC_NS_RFT_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 114 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 115 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 116 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 117 ct->payload.rft.fts = lport->fcts;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 118 break;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 119
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 120 case FC_NS_RFF_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 121 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 122 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 123 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 124 ct->payload.rff.fr_type = FC_TYPE_FCP;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 125 if (lport->service_params & FCP_SPPF_INIT_FCN)
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 126 ct->payload.rff.fr_feat = FCP_FEAT_INIT;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 127 if (lport->service_params & FCP_SPPF_TARG_FCN)
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 128 ct->payload.rff.fr_feat |= FCP_FEAT_TARG;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 129 break;
ab593b187391bd include/scsi/fc_encode.h Joe Eykholt 2009-11-03 130
c9c7bd7a5e7321 include/scsi/fc_encode.h Chris Leech 2009-11-03 131 case FC_NS_RNN_ID:
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 132 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id),
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 133 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 134 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
c9c7bd7a5e7321 include/scsi/fc_encode.h Chris Leech 2009-11-03 135 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 136 break;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 137
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 138 case FC_NS_RSPN_ID:
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 139 len = strnlen(fc_host_symbolic_name(lport->host), 255);
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 140 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len,
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 141 FC_FST_DIR, FC_NS_SUBTYPE);
7b2787ec15b9d1 include/scsi/fc_encode.h Robert Love 2010-05-07 142 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 143 strncpy(ct->payload.spn.fr_name,
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 144 fc_host_symbolic_name(lport->host), len);
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 145 ct->payload.spn.fr_name_len = len;
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 146 break;
c9866a548024c3 include/scsi/fc_encode.h Chris Leech 2009-11-03 147
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 148 case FC_NS_RSNN_NN:
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 149 len = strnlen(fc_host_symbolic_name(lport->host), 255);
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 150 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len,
1ea2c1daf4476a include/scsi/fc_encode.h Neerav Parikh 2012-01-22 151 FC_FST_DIR, FC_NS_SUBTYPE);
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 152 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 @153 strncpy(ct->payload.snn.fr_name,
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 154 fc_host_symbolic_name(lport->host), len);
5f9a056db9c797 include/scsi/fc_encode.h Joe Eykholt 2009-11-03 155 ct->payload.snn.fr_name_len = len;
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 156 break;
5baa17c3e66fc2 include/scsi/fc_encode.h Chris Leech 2009-11-03 157
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 158 default:
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 159 return -EINVAL;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 160 }
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 161 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 162 *fh_type = FC_TYPE_CT;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 163 return 0;
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 164 }
42e9a92fe6a909 include/scsi/fc_encode.h Robert Love 2008-12-09 165
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30846 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc
2020-10-26 16:06 [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc Arnd Bergmann
2020-10-26 16:06 ` [PATCH 2/2] libfc: work around Warray-bounds warning Arnd Bergmann
2020-10-27 2:39 ` [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc kernel test robot
@ 2020-10-30 1:52 ` Martin K. Petersen
2020-11-05 4:21 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2020-10-30 1:52 UTC (permalink / raw)
To: Arnd Bergmann
Cc: James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke,
Arnd Bergmann, Saurav Kashyap, Javed Hasan,
GR-QLogic-Storage-Upstream, Gustavo A. R. Silva, Lee Jones,
linux-scsi, linux-kernel, target-devel
Arnd,
> Most of this file is only used inside of libfc, so move it to where it
> is actually used, with only fc_fill_fc_hdr() left inside of the
> header.
Applied to 5.11/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc
2020-10-26 16:06 [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc Arnd Bergmann
` (2 preceding siblings ...)
2020-10-30 1:52 ` Martin K. Petersen
@ 2020-11-05 4:21 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2020-11-05 4:21 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, Arnd Bergmann
Cc: Martin K . Petersen, GR-QLogic-Storage-Upstream, target-devel,
Gustavo A. R. Silva, Arnd Bergmann, Lee Jones, linux-scsi,
linux-kernel, Javed Hasan, Saurav Kashyap
On Mon, 26 Oct 2020 17:06:12 +0100, Arnd Bergmann wrote:
> Most of this file is only used inside of libfc, so move
> it to where it is actually used, with only fc_fill_fc_hdr()
> left inside of the header.
Applied to 5.11/scsi-queue, thanks!
[1/2] scsi: libfc: Move scsi/fc_encode.h to libfc
https://git.kernel.org/mkp/scsi/c/e31ac898ac29
[2/2] scsi: libfc: Work around -Warray-bounds warning
https://git.kernel.org/mkp/scsi/c/8fd9efca86d0
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-05 4:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 16:06 [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc Arnd Bergmann
2020-10-26 16:06 ` [PATCH 2/2] libfc: work around Warray-bounds warning Arnd Bergmann
2020-10-27 2:39 ` [PATCH 1/2] libfc: move scsi/fc_encode.h to libfc kernel test robot
2020-10-30 1:52 ` Martin K. Petersen
2020-11-05 4:21 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).