You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/01/27 09:07:31 UTC

[GitHub] [nuttx] xiaoxiang781216 opened a new pull request, #8279: dns: packed dns_header_s and dns_question_s

xiaoxiang781216 opened a new pull request, #8279:
URL: https://github.com/apache/nuttx/pull/8279

   ## Summary
   
   avoid the unalignment issue
   
   ## Impact
   
   Minor
   
   ## Testing
   
   Pass CI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8279: dns: packed dns_header_s and dns_question_s

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #8279:
URL: https://github.com/apache/nuttx/pull/8279#discussion_r1088982454


##########
libs/libc/netdb/lib_dnsquery.c:
##########
@@ -438,13 +437,12 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int naddr,
   /* Validate query type and class */
 
   que = (FAR struct dns_question_s *)nameptr;
-  memcpy(&bak, que, sizeof(struct dns_question_s));
 
   /* N.B. Unaligned access may occur here */

Review Comment:
   Should we still keep this comment here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8279: dns: packed dns_header_s and dns_question_s

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8279:
URL: https://github.com/apache/nuttx/pull/8279#discussion_r1088941598


##########
include/nuttx/net/dns.h:
##########
@@ -147,15 +147,15 @@ struct dns_header_s
   uint16_t numanswers;
   uint16_t numauthrr;
   uint16_t numextrarr;
-};
+}end_packed_struct;

Review Comment:
   Done.



##########
include/nuttx/net/dns.h:
##########
@@ -147,15 +147,15 @@ struct dns_header_s
   uint16_t numanswers;
   uint16_t numauthrr;
   uint16_t numextrarr;
-};
+}end_packed_struct;
 
 /* The DNS question message structure */
 
-struct dns_question_s
+begin_packed_struct struct dns_question_s
 {
   uint16_t type;
   uint16_t class;
-};
+}end_packed_struct;

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] anchao merged pull request #8279: dns: packed dns_header_s and dns_question_s

Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao merged PR #8279:
URL: https://github.com/apache/nuttx/pull/8279


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8279: dns: packed dns_header_s and dns_question_s

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8279:
URL: https://github.com/apache/nuttx/pull/8279#discussion_r1089059682


##########
libs/libc/netdb/lib_dnsquery.c:
##########
@@ -438,13 +437,12 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int naddr,
   /* Validate query type and class */
 
   que = (FAR struct dns_question_s *)nameptr;
-  memcpy(&bak, que, sizeof(struct dns_question_s));
 
   /* N.B. Unaligned access may occur here */

Review Comment:
   Yes, since que may be unaligned.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8279: dns: packed dns_header_s and dns_question_s

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #8279:
URL: https://github.com/apache/nuttx/pull/8279#discussion_r1088802615


##########
include/nuttx/net/dns.h:
##########
@@ -147,15 +147,15 @@ struct dns_header_s
   uint16_t numanswers;
   uint16_t numauthrr;
   uint16_t numextrarr;
-};
+}end_packed_struct;

Review Comment:
   ```suggestion
   } end_packed_struct;
   ```



##########
include/nuttx/net/dns.h:
##########
@@ -147,15 +147,15 @@ struct dns_header_s
   uint16_t numanswers;
   uint16_t numauthrr;
   uint16_t numextrarr;
-};
+}end_packed_struct;
 
 /* The DNS question message structure */
 
-struct dns_question_s
+begin_packed_struct struct dns_question_s
 {
   uint16_t type;
   uint16_t class;
-};
+}end_packed_struct;

Review Comment:
   ```suggestion
   } end_packed_struct;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org