2022-06-30 10:18:01

by Yu Zhe

[permalink] [raw]
Subject: [PATCH] cifs: remove unnecessary type castings

remove unnecessary void* type castings.

Signed-off-by: Yu Zhe <[email protected]>
---
fs/cifs/connect.c | 2 +-
fs/cifs/inode.c | 4 ++--
fs/cifs/netmisc.c | 2 +-
fs/cifs/smb2misc.c | 2 +-
fs/cifs/smb2pdu.c | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index fa29c9aae24b..90863b3b5204 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2646,7 +2646,7 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
int
cifs_match_super(struct super_block *sb, void *data)
{
- struct cifs_mnt_data *mnt_data = (struct cifs_mnt_data *)data;
+ struct cifs_mnt_data *mnt_data = data;
struct smb3_fs_context *ctx;
struct cifs_sb_info *cifs_sb;
struct TCP_Server_Info *tcp_srv;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 81da81e18553..3ad303dd5e5a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1223,7 +1223,7 @@ static const struct inode_operations cifs_ipc_inode_ops = {
static int
cifs_find_inode(struct inode *inode, void *opaque)
{
- struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
+ struct cifs_fattr *fattr = opaque;

/* don't match inode with different uniqueid */
if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid)
@@ -1247,7 +1247,7 @@ cifs_find_inode(struct inode *inode, void *opaque)
static int
cifs_init_inode(struct inode *inode, void *opaque)
{
- struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
+ struct cifs_fattr *fattr = opaque;

CIFS_I(inode)->uniqueid = fattr->cf_uniqueid;
CIFS_I(inode)->createtime = fattr->cf_createtime;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 235aa1b395eb..28caae7aed1b 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -911,7 +911,7 @@ map_and_check_smb_error(struct mid_q_entry *mid, bool logErr)
unsigned int
smbCalcSize(void *buf, struct TCP_Server_Info *server)
{
- struct smb_hdr *ptr = (struct smb_hdr *)buf;
+ struct smb_hdr *ptr = buf;
return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
2 /* size of the bcc field */ + get_bcc(ptr));
}
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 17813c3d0c6e..db0f27fd373b 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -402,7 +402,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *shdr)
unsigned int
smb2_calc_size(void *buf, struct TCP_Server_Info *srvr)
{
- struct smb2_pdu *pdu = (struct smb2_pdu *)buf;
+ struct smb2_pdu *pdu = buf;
struct smb2_hdr *shdr = &pdu->hdr;
int offset; /* the offset from the beginning of SMB to data area */
int data_length; /* the length of the variable length data area */
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 12b4dddaedb0..92fb513e5478 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -354,7 +354,7 @@ fill_small_buf(__le16 smb2_command, struct cifs_tcon *tcon,
void *buf,
unsigned int *total_len)
{
- struct smb2_pdu *spdu = (struct smb2_pdu *)buf;
+ struct smb2_pdu *spdu = buf;
/* lookup word count ie StructureSize from table */
__u16 parmsize = smb2_req_struct_sizes[le16_to_cpu(smb2_command)];

--
2.11.0


2022-07-16 04:05:10

by Steve French

[permalink] [raw]
Subject: Re: [PATCH] cifs: remove unnecessary type castings

merged into cifs-2.6.git for-next

On Thu, Jun 30, 2022 at 4:38 AM Yu Zhe <[email protected]> wrote:
>
> remove unnecessary void* type castings.
>
> Signed-off-by: Yu Zhe <[email protected]>
> ---
> fs/cifs/connect.c | 2 +-
> fs/cifs/inode.c | 4 ++--
> fs/cifs/netmisc.c | 2 +-
> fs/cifs/smb2misc.c | 2 +-
> fs/cifs/smb2pdu.c | 2 +-
> 5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index fa29c9aae24b..90863b3b5204 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2646,7 +2646,7 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
> int
> cifs_match_super(struct super_block *sb, void *data)
> {
> - struct cifs_mnt_data *mnt_data = (struct cifs_mnt_data *)data;
> + struct cifs_mnt_data *mnt_data = data;
> struct smb3_fs_context *ctx;
> struct cifs_sb_info *cifs_sb;
> struct TCP_Server_Info *tcp_srv;
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index 81da81e18553..3ad303dd5e5a 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -1223,7 +1223,7 @@ static const struct inode_operations cifs_ipc_inode_ops = {
> static int
> cifs_find_inode(struct inode *inode, void *opaque)
> {
> - struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
> + struct cifs_fattr *fattr = opaque;
>
> /* don't match inode with different uniqueid */
> if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid)
> @@ -1247,7 +1247,7 @@ cifs_find_inode(struct inode *inode, void *opaque)
> static int
> cifs_init_inode(struct inode *inode, void *opaque)
> {
> - struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
> + struct cifs_fattr *fattr = opaque;
>
> CIFS_I(inode)->uniqueid = fattr->cf_uniqueid;
> CIFS_I(inode)->createtime = fattr->cf_createtime;
> diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
> index 235aa1b395eb..28caae7aed1b 100644
> --- a/fs/cifs/netmisc.c
> +++ b/fs/cifs/netmisc.c
> @@ -911,7 +911,7 @@ map_and_check_smb_error(struct mid_q_entry *mid, bool logErr)
> unsigned int
> smbCalcSize(void *buf, struct TCP_Server_Info *server)
> {
> - struct smb_hdr *ptr = (struct smb_hdr *)buf;
> + struct smb_hdr *ptr = buf;
> return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
> 2 /* size of the bcc field */ + get_bcc(ptr));
> }
> diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
> index 17813c3d0c6e..db0f27fd373b 100644
> --- a/fs/cifs/smb2misc.c
> +++ b/fs/cifs/smb2misc.c
> @@ -402,7 +402,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *shdr)
> unsigned int
> smb2_calc_size(void *buf, struct TCP_Server_Info *srvr)
> {
> - struct smb2_pdu *pdu = (struct smb2_pdu *)buf;
> + struct smb2_pdu *pdu = buf;
> struct smb2_hdr *shdr = &pdu->hdr;
> int offset; /* the offset from the beginning of SMB to data area */
> int data_length; /* the length of the variable length data area */
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 12b4dddaedb0..92fb513e5478 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -354,7 +354,7 @@ fill_small_buf(__le16 smb2_command, struct cifs_tcon *tcon,
> void *buf,
> unsigned int *total_len)
> {
> - struct smb2_pdu *spdu = (struct smb2_pdu *)buf;
> + struct smb2_pdu *spdu = buf;
> /* lookup word count ie StructureSize from table */
> __u16 parmsize = smb2_req_struct_sizes[le16_to_cpu(smb2_command)];
>
> --
> 2.11.0
>


--
Thanks,

Steve

2022-07-16 04:37:32

by Steve French

[permalink] [raw]
Subject: Re: [PATCH] cifs: remove unnecessary type castings

And added one more part of which was included in your previous patch
but not this part.


On Fri, Jul 15, 2022 at 10:47 PM Steve French <[email protected]> wrote:
>
> merged into cifs-2.6.git for-next
>
> On Thu, Jun 30, 2022 at 4:38 AM Yu Zhe <[email protected]> wrote:
> >
> > remove unnecessary void* type castings.
> >
> > Signed-off-by: Yu Zhe <[email protected]>
> > ---
> > fs/cifs/connect.c | 2 +-
> > fs/cifs/inode.c | 4 ++--
> > fs/cifs/netmisc.c | 2 +-
> > fs/cifs/smb2misc.c | 2 +-
> > fs/cifs/smb2pdu.c | 2 +-
> > 5 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> > index fa29c9aae24b..90863b3b5204 100644
> > --- a/fs/cifs/connect.c
> > +++ b/fs/cifs/connect.c
> > @@ -2646,7 +2646,7 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
> > int
> > cifs_match_super(struct super_block *sb, void *data)
> > {
> > - struct cifs_mnt_data *mnt_data = (struct cifs_mnt_data *)data;
> > + struct cifs_mnt_data *mnt_data = data;
> > struct smb3_fs_context *ctx;
> > struct cifs_sb_info *cifs_sb;
> > struct TCP_Server_Info *tcp_srv;
> > diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> > index 81da81e18553..3ad303dd5e5a 100644
> > --- a/fs/cifs/inode.c
> > +++ b/fs/cifs/inode.c
> > @@ -1223,7 +1223,7 @@ static const struct inode_operations cifs_ipc_inode_ops = {
> > static int
> > cifs_find_inode(struct inode *inode, void *opaque)
> > {
> > - struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
> > + struct cifs_fattr *fattr = opaque;
> >
> > /* don't match inode with different uniqueid */
> > if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid)
> > @@ -1247,7 +1247,7 @@ cifs_find_inode(struct inode *inode, void *opaque)
> > static int
> > cifs_init_inode(struct inode *inode, void *opaque)
> > {
> > - struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
> > + struct cifs_fattr *fattr = opaque;
> >
> > CIFS_I(inode)->uniqueid = fattr->cf_uniqueid;
> > CIFS_I(inode)->createtime = fattr->cf_createtime;
> > diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
> > index 235aa1b395eb..28caae7aed1b 100644
> > --- a/fs/cifs/netmisc.c
> > +++ b/fs/cifs/netmisc.c
> > @@ -911,7 +911,7 @@ map_and_check_smb_error(struct mid_q_entry *mid, bool logErr)
> > unsigned int
> > smbCalcSize(void *buf, struct TCP_Server_Info *server)
> > {
> > - struct smb_hdr *ptr = (struct smb_hdr *)buf;
> > + struct smb_hdr *ptr = buf;
> > return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
> > 2 /* size of the bcc field */ + get_bcc(ptr));
> > }
> > diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
> > index 17813c3d0c6e..db0f27fd373b 100644
> > --- a/fs/cifs/smb2misc.c
> > +++ b/fs/cifs/smb2misc.c
> > @@ -402,7 +402,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *shdr)
> > unsigned int
> > smb2_calc_size(void *buf, struct TCP_Server_Info *srvr)
> > {
> > - struct smb2_pdu *pdu = (struct smb2_pdu *)buf;
> > + struct smb2_pdu *pdu = buf;
> > struct smb2_hdr *shdr = &pdu->hdr;
> > int offset; /* the offset from the beginning of SMB to data area */
> > int data_length; /* the length of the variable length data area */
> > diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> > index 12b4dddaedb0..92fb513e5478 100644
> > --- a/fs/cifs/smb2pdu.c
> > +++ b/fs/cifs/smb2pdu.c
> > @@ -354,7 +354,7 @@ fill_small_buf(__le16 smb2_command, struct cifs_tcon *tcon,
> > void *buf,
> > unsigned int *total_len)
> > {
> > - struct smb2_pdu *spdu = (struct smb2_pdu *)buf;
> > + struct smb2_pdu *spdu = buf;
> > /* lookup word count ie StructureSize from table */
> > __u16 parmsize = smb2_req_struct_sizes[le16_to_cpu(smb2_command)];
> >
> > --
> > 2.11.0
> >
>
>
> --
> Thanks,
>
> Steve



--
Thanks,

Steve


Attachments:
0002-cifs-remove-unnecessary-void-conversions.patch (966.00 B)